diff --git a/exercises/build.gradle b/exercises/build.gradle index 0a019cfab..61b8e4a1a 100644 --- a/exercises/build.gradle +++ b/exercises/build.gradle @@ -57,7 +57,10 @@ subprojects { logCompileTaskSourcePath(project, "compileJava") // Corresponds to the "main" source set. logCompileTaskSourcePath(project, "compileStarterSourceJava") logCompileTaskSourcePath(project, "compileTestJava") + } + configurations { + starterSourceImplementation.extendsFrom implementation } // configuration of the linter diff --git a/exercises/practice/all-your-base/src/main/java/BaseConverter.java b/exercises/practice/all-your-base/src/main/java/BaseConverter.java index 6178f1beb..c347144ec 100644 --- a/exercises/practice/all-your-base/src/main/java/BaseConverter.java +++ b/exercises/practice/all-your-base/src/main/java/BaseConverter.java @@ -1,10 +1,11 @@ -/* +class BaseConverter { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + BaseConverter(int originalBase, int[] originalDigits) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + int[] convertToBase(int newBase) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/alphametics/src/main/java/Alphametics.java b/exercises/practice/alphametics/src/main/java/Alphametics.java index 6178f1beb..1ac637d9c 100644 --- a/exercises/practice/alphametics/src/main/java/Alphametics.java +++ b/exercises/practice/alphametics/src/main/java/Alphametics.java @@ -1,10 +1,13 @@ -/* +import java.util.Map; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class Alphametics { -Please remove this comment when submitting your solution. + Alphametics(String userInput) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + Map solve() throws UnsolvablePuzzleException { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/atbash-cipher/src/main/java/Atbash.java b/exercises/practice/atbash-cipher/src/main/java/Atbash.java index 6178f1beb..e5ea2147a 100644 --- a/exercises/practice/atbash-cipher/src/main/java/Atbash.java +++ b/exercises/practice/atbash-cipher/src/main/java/Atbash.java @@ -1,10 +1,11 @@ -/* +class Atbash { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + String encode(String input) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String decode(String input) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} diff --git a/exercises/practice/bank-account/src/main/java/BankAccount.java b/exercises/practice/bank-account/src/main/java/BankAccount.java index 6178f1beb..61625bd6d 100644 --- a/exercises/practice/bank-account/src/main/java/BankAccount.java +++ b/exercises/practice/bank-account/src/main/java/BankAccount.java @@ -1,10 +1,23 @@ -/* +class BankAccount { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + void open() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + void close() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + synchronized int getBalance() throws BankAccountActionInvalidException { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + synchronized void deposit(int amount) throws BankAccountActionInvalidException { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + synchronized void withdraw(int amount) throws BankAccountActionInvalidException { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/beer-song/src/main/java/BeerSong.java b/exercises/practice/beer-song/src/main/java/BeerSong.java index 6178f1beb..9fe51b1f5 100644 --- a/exercises/practice/beer-song/src/main/java/BeerSong.java +++ b/exercises/practice/beer-song/src/main/java/BeerSong.java @@ -1,10 +1,11 @@ -/* +class BeerSong { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + String sing(int startBottles, int takeDown) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String singSong() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/bob/src/main/java/Bob.java b/exercises/practice/bob/src/main/java/Bob.java index 6178f1beb..75d18c343 100644 --- a/exercises/practice/bob/src/main/java/Bob.java +++ b/exercises/practice/bob/src/main/java/Bob.java @@ -1,10 +1,7 @@ -/* +class Bob { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + String hey(String input) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. - -*/ +} \ No newline at end of file diff --git a/exercises/practice/book-store/src/main/java/BookStore.java b/exercises/practice/book-store/src/main/java/BookStore.java index 6178f1beb..f0f2e09fc 100644 --- a/exercises/practice/book-store/src/main/java/BookStore.java +++ b/exercises/practice/book-store/src/main/java/BookStore.java @@ -1,10 +1,9 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class BookStore { -Please remove this comment when submitting your solution. + double calculateBasketCost(List books) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/bowling/src/main/java/BowlingGame.java b/exercises/practice/bowling/src/main/java/BowlingGame.java index 6178f1beb..0a84e90da 100644 --- a/exercises/practice/bowling/src/main/java/BowlingGame.java +++ b/exercises/practice/bowling/src/main/java/BowlingGame.java @@ -1,10 +1,11 @@ -/* +class BowlingGame { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + void roll(int pins) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + int score() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/change/src/main/java/ChangeCalculator.java b/exercises/practice/change/src/main/java/ChangeCalculator.java index 6178f1beb..658ff749c 100644 --- a/exercises/practice/change/src/main/java/ChangeCalculator.java +++ b/exercises/practice/change/src/main/java/ChangeCalculator.java @@ -1,10 +1,13 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class ChangeCalculator { -Please remove this comment when submitting your solution. + ChangeCalculator(List currencyCoins) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + List computeMostEfficientChange(int grandTotal) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} diff --git a/exercises/practice/circular-buffer/src/main/java/CircularBuffer.java b/exercises/practice/circular-buffer/src/main/java/CircularBuffer.java index 6178f1beb..0abe27796 100644 --- a/exercises/practice/circular-buffer/src/main/java/CircularBuffer.java +++ b/exercises/practice/circular-buffer/src/main/java/CircularBuffer.java @@ -1,10 +1,23 @@ -/* +class CircularBuffer { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + CircularBuffer(final int size) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + T read() throws BufferIOException { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + void write(T data) throws BufferIOException { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + void overwrite(T data) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + void clear() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/clock/src/main/java/Clock.java b/exercises/practice/clock/src/main/java/Clock.java index 6178f1beb..91ede5436 100644 --- a/exercises/practice/clock/src/main/java/Clock.java +++ b/exercises/practice/clock/src/main/java/Clock.java @@ -1,10 +1,21 @@ -/* +class Clock { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + Clock(int hours, int minutes) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + void add(int minutes) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + @Override + public String toString() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + @Override + public boolean equals(Object obj) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/complex-numbers/src/main/java/ComplexNumber.java b/exercises/practice/complex-numbers/src/main/java/ComplexNumber.java index 6178f1beb..88c32482b 100644 --- a/exercises/practice/complex-numbers/src/main/java/ComplexNumber.java +++ b/exercises/practice/complex-numbers/src/main/java/ComplexNumber.java @@ -1,10 +1,51 @@ -/* +class ComplexNumber { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + ComplexNumber(double real, double imag) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + double getReal() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + double getImag() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + double abs() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber add(ComplexNumber other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber minus(ComplexNumber other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber times(ComplexNumber other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber times(double factor) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber div(ComplexNumber other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber div(double divisor) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber conjugate() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + ComplexNumber exponentialOf() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/crypto-square/src/main/java/CryptoSquare.java b/exercises/practice/crypto-square/src/main/java/CryptoSquare.java index 6178f1beb..799c56095 100644 --- a/exercises/practice/crypto-square/src/main/java/CryptoSquare.java +++ b/exercises/practice/crypto-square/src/main/java/CryptoSquare.java @@ -1,10 +1,11 @@ -/* +class CryptoSquare { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + CryptoSquare(String plaintext) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String getCiphertext() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} diff --git a/exercises/practice/custom-set/src/main/java/CustomSet.java b/exercises/practice/custom-set/src/main/java/CustomSet.java index 6178f1beb..2903faeaf 100644 --- a/exercises/practice/custom-set/src/main/java/CustomSet.java +++ b/exercises/practice/custom-set/src/main/java/CustomSet.java @@ -1,10 +1,46 @@ -/* +import java.util.Collection; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class CustomSet { -Please remove this comment when submitting your solution. + CustomSet() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + CustomSet(Collection data) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + boolean isEmpty() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + boolean contains(T element) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + boolean isDisjoint(CustomSet other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + boolean add(T element) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + @Override + public boolean equals(Object obj) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + CustomSet getIntersection(CustomSet other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + CustomSet getUnion(CustomSet other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + CustomSet getDifference(CustomSet other) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} diff --git a/exercises/practice/diffie-hellman/src/main/java/DiffieHellman.java b/exercises/practice/diffie-hellman/src/main/java/DiffieHellman.java index 6178f1beb..985b537d5 100644 --- a/exercises/practice/diffie-hellman/src/main/java/DiffieHellman.java +++ b/exercises/practice/diffie-hellman/src/main/java/DiffieHellman.java @@ -1,10 +1,17 @@ -/* +import java.math.BigInteger; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class DiffieHellman { -Please remove this comment when submitting your solution. + BigInteger privateKey(BigInteger primeP) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + BigInteger publicKey(BigInteger primeP, BigInteger primeG, BigInteger privateKey) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + BigInteger secret(BigInteger primeP, BigInteger publicKey, BigInteger privateKey) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/dominoes/src/main/java/Dominoes.java b/exercises/practice/dominoes/src/main/java/Dominoes.java index 6178f1beb..6889a104e 100644 --- a/exercises/practice/dominoes/src/main/java/Dominoes.java +++ b/exercises/practice/dominoes/src/main/java/Dominoes.java @@ -1,10 +1,9 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class Dominoes { -Please remove this comment when submitting your solution. + List formChain(List inputDominoes) throws ChainNotFoundException { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/flatten-array/src/main/java/Flattener.java b/exercises/practice/flatten-array/src/main/java/Flattener.java index 6178f1beb..c2759577f 100644 --- a/exercises/practice/flatten-array/src/main/java/Flattener.java +++ b/exercises/practice/flatten-array/src/main/java/Flattener.java @@ -1,10 +1,9 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class Flattener { -Please remove this comment when submitting your solution. + List flatten(List list) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/food-chain/src/main/java/FoodChain.java b/exercises/practice/food-chain/src/main/java/FoodChain.java index 6178f1beb..194494cd6 100644 --- a/exercises/practice/food-chain/src/main/java/FoodChain.java +++ b/exercises/practice/food-chain/src/main/java/FoodChain.java @@ -1,10 +1,11 @@ -/* +class FoodChain { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + String verse(int verse) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String verses(int startVerse, int endVerse) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/go-counting/src/main/java/GoCounting.java b/exercises/practice/go-counting/src/main/java/GoCounting.java index 6178f1beb..23907fdd5 100644 --- a/exercises/practice/go-counting/src/main/java/GoCounting.java +++ b/exercises/practice/go-counting/src/main/java/GoCounting.java @@ -1,10 +1,23 @@ -/* +import java.awt.Point; +import java.util.Map; +import java.util.Set; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class GoCounting { -Please remove this comment when submitting your solution. + GoCounting(String board) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + Player getTerritoryOwner(int x, int y) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + Set getTerritory(int x, int y) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + Map> getTerritories() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/grade-school/src/main/java/School.java b/exercises/practice/grade-school/src/main/java/School.java index 6178f1beb..599b475d8 100644 --- a/exercises/practice/grade-school/src/main/java/School.java +++ b/exercises/practice/grade-school/src/main/java/School.java @@ -1,10 +1,17 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class School { -Please remove this comment when submitting your solution. + void add(String student, int grade) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + List roster() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + List grade(int grade) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} diff --git a/exercises/practice/grep/src/main/java/GrepTool.java b/exercises/practice/grep/src/main/java/GrepTool.java index 6178f1beb..762980881 100644 --- a/exercises/practice/grep/src/main/java/GrepTool.java +++ b/exercises/practice/grep/src/main/java/GrepTool.java @@ -1,10 +1,9 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class GrepTool { -Please remove this comment when submitting your solution. + String grep(String pattern, List flags, List files) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/hangman/src/main/java/Hangman.java b/exercises/practice/hangman/src/main/java/Hangman.java index 6178f1beb..abab3240f 100644 --- a/exercises/practice/hangman/src/main/java/Hangman.java +++ b/exercises/practice/hangman/src/main/java/Hangman.java @@ -1,10 +1,9 @@ -/* +import io.reactivex.Observable; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class Hangman { -Please remove this comment when submitting your solution. + Observable play(Observable words, Observable letters) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/hangman/src/main/java/Output.java b/exercises/practice/hangman/src/main/java/Output.java index 2d35f1353..c4376f901 100644 --- a/exercises/practice/hangman/src/main/java/Output.java +++ b/exercises/practice/hangman/src/main/java/Output.java @@ -1,11 +1,6 @@ -import static java.util.stream.Collectors.joining; - -import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.stream.IntStream; class Output { diff --git a/exercises/practice/house/src/main/java/House.java b/exercises/practice/house/src/main/java/House.java index 6178f1beb..409de0aac 100644 --- a/exercises/practice/house/src/main/java/House.java +++ b/exercises/practice/house/src/main/java/House.java @@ -1,10 +1,15 @@ -/* +class House { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + String verse(int verse) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String verses(int startVerse, int endVerse) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + String sing() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/knapsack/.meta/config.json b/exercises/practice/knapsack/.meta/config.json index 7383fe9a4..260ef5f9c 100644 --- a/exercises/practice/knapsack/.meta/config.json +++ b/exercises/practice/knapsack/.meta/config.json @@ -18,6 +18,9 @@ "example": [ ".meta/src/reference/java/Knapsack.java" ], + "editor": [ + "src/main/java/Item.java" + ], "invalidator": [ "build.gradle" ] diff --git a/exercises/practice/knapsack/src/main/java/Item.java b/exercises/practice/knapsack/src/main/java/Item.java new file mode 100644 index 000000000..dcea2b38d --- /dev/null +++ b/exercises/practice/knapsack/src/main/java/Item.java @@ -0,0 +1,13 @@ +class Item { + + // Weight of the item + int weight; + // Value of the item + int value; + + Item(int itemWeight, int itemValue) { + this.weight = itemWeight; + this.value = itemValue; + } + +} diff --git a/exercises/practice/knapsack/src/main/java/Knapsack.java b/exercises/practice/knapsack/src/main/java/Knapsack.java index 56c37eaf2..42891b353 100644 --- a/exercises/practice/knapsack/src/main/java/Knapsack.java +++ b/exercises/practice/knapsack/src/main/java/Knapsack.java @@ -1,7 +1,9 @@ -/* -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. -Please remove this comment when submitting your solution. -*/ +import java.util.List; + +class Knapsack { + + int maximumValue(int maximumWeight, List items) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/matching-brackets/src/main/java/BracketChecker.java b/exercises/practice/matching-brackets/src/main/java/BracketChecker.java index 6178f1beb..906f68315 100644 --- a/exercises/practice/matching-brackets/src/main/java/BracketChecker.java +++ b/exercises/practice/matching-brackets/src/main/java/BracketChecker.java @@ -1,10 +1,11 @@ -/* +class BracketChecker { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + BracketChecker(String expression) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + boolean areBracketsMatchedAndNestedCorrectly() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/meetup/src/main/java/Meetup.java b/exercises/practice/meetup/src/main/java/Meetup.java index 6178f1beb..c53792961 100644 --- a/exercises/practice/meetup/src/main/java/Meetup.java +++ b/exercises/practice/meetup/src/main/java/Meetup.java @@ -1,10 +1,14 @@ -/* +import java.time.DayOfWeek; +import java.time.LocalDate; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class Meetup { -Please remove this comment when submitting your solution. + Meetup(int monthOfYear, int year) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + LocalDate day(DayOfWeek dayOfWeek, MeetupSchedule schedule) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/minesweeper/src/main/java/MinesweeperBoard.java b/exercises/practice/minesweeper/src/main/java/MinesweeperBoard.java index 6178f1beb..2ab5ef342 100644 --- a/exercises/practice/minesweeper/src/main/java/MinesweeperBoard.java +++ b/exercises/practice/minesweeper/src/main/java/MinesweeperBoard.java @@ -1,10 +1,13 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class MinesweeperBoard { -Please remove this comment when submitting your solution. + MinesweeperBoard(List boardRows) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + List withNumbers() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/nucleotide-count/src/main/java/NucleotideCounter.java b/exercises/practice/nucleotide-count/src/main/java/NucleotideCounter.java index 6178f1beb..2a349e479 100644 --- a/exercises/practice/nucleotide-count/src/main/java/NucleotideCounter.java +++ b/exercises/practice/nucleotide-count/src/main/java/NucleotideCounter.java @@ -1,10 +1,17 @@ -/* +import java.util.Map; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class NucleotideCounter { -Please remove this comment when submitting your solution. + NucleotideCounter(String sequence) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + int count(char base) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + Map nucleotideCounts() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/ocr-numbers/src/main/java/OpticalCharacterReader.java b/exercises/practice/ocr-numbers/src/main/java/OpticalCharacterReader.java index 6178f1beb..cbbe27cd9 100644 --- a/exercises/practice/ocr-numbers/src/main/java/OpticalCharacterReader.java +++ b/exercises/practice/ocr-numbers/src/main/java/OpticalCharacterReader.java @@ -1,10 +1,9 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class OpticalCharacterReader { -Please remove this comment when submitting your solution. + String parse(List input) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/palindrome-products/src/main/java/PalindromeCalculator.java b/exercises/practice/palindrome-products/src/main/java/PalindromeCalculator.java index 6178f1beb..bf8bdb8e7 100644 --- a/exercises/practice/palindrome-products/src/main/java/PalindromeCalculator.java +++ b/exercises/practice/palindrome-products/src/main/java/PalindromeCalculator.java @@ -1,10 +1,10 @@ -/* +import java.util.List; +import java.util.SortedMap; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class PalindromeCalculator { -Please remove this comment when submitting your solution. + SortedMap>> getPalindromeProductsWithFactors(int minFactor, int maxFactor) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/parallel-letter-frequency/src/main/java/ParallelLetterFrequency.java b/exercises/practice/parallel-letter-frequency/src/main/java/ParallelLetterFrequency.java index 6178f1beb..93f41ee86 100644 --- a/exercises/practice/parallel-letter-frequency/src/main/java/ParallelLetterFrequency.java +++ b/exercises/practice/parallel-letter-frequency/src/main/java/ParallelLetterFrequency.java @@ -1,10 +1,13 @@ -/* +import java.util.Map; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class ParallelLetterFrequency { -Please remove this comment when submitting your solution. + ParallelLetterFrequency(String letters) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + Map letterCounts() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/pascals-triangle/src/main/java/PascalsTriangleGenerator.java b/exercises/practice/pascals-triangle/src/main/java/PascalsTriangleGenerator.java index 6178f1beb..eb2480bc4 100644 --- a/exercises/practice/pascals-triangle/src/main/java/PascalsTriangleGenerator.java +++ b/exercises/practice/pascals-triangle/src/main/java/PascalsTriangleGenerator.java @@ -1,10 +1,7 @@ -/* +class PascalsTriangleGenerator { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + int[][] generateTriangle(int rows) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. - -*/ +} \ No newline at end of file diff --git a/exercises/practice/phone-number/src/main/java/PhoneNumber.java b/exercises/practice/phone-number/src/main/java/PhoneNumber.java index 6178f1beb..20bd0cf0c 100644 --- a/exercises/practice/phone-number/src/main/java/PhoneNumber.java +++ b/exercises/practice/phone-number/src/main/java/PhoneNumber.java @@ -1,10 +1,11 @@ -/* +class PhoneNumber { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + PhoneNumber(String numberString) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String getNumber() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/poker/src/main/java/Poker.java b/exercises/practice/poker/src/main/java/Poker.java index 6178f1beb..c6ed7e8a6 100644 --- a/exercises/practice/poker/src/main/java/Poker.java +++ b/exercises/practice/poker/src/main/java/Poker.java @@ -1,10 +1,13 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class Poker { -Please remove this comment when submitting your solution. + Poker(List hand) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + List getBestHands() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/prime-factors/src/main/java/PrimeFactorsCalculator.java b/exercises/practice/prime-factors/src/main/java/PrimeFactorsCalculator.java index 6178f1beb..a7ed6ad39 100644 --- a/exercises/practice/prime-factors/src/main/java/PrimeFactorsCalculator.java +++ b/exercises/practice/prime-factors/src/main/java/PrimeFactorsCalculator.java @@ -1,10 +1,9 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class PrimeFactorsCalculator { -Please remove this comment when submitting your solution. + List calculatePrimeFactorsOf(int number) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/pythagorean-triplet/src/main/java/PythagoreanTriplet.java b/exercises/practice/pythagorean-triplet/src/main/java/PythagoreanTriplet.java index 6178f1beb..7d309abea 100644 --- a/exercises/practice/pythagorean-triplet/src/main/java/PythagoreanTriplet.java +++ b/exercises/practice/pythagorean-triplet/src/main/java/PythagoreanTriplet.java @@ -1,10 +1,29 @@ -/* +import java.util.List; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class PythagoreanTriplet { -Please remove this comment when submitting your solution. + PythagoreanTriplet(int a, int b, int c) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + TripletListBuilder makeTripletsList() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + class TripletListBuilder { + + TripletListBuilder thatSumTo(int sum) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + TripletListBuilder withFactorsLessThanOrEqualTo(int maxFactor) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + List build() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + } + +} \ No newline at end of file diff --git a/exercises/practice/queen-attack/.meta/config.json b/exercises/practice/queen-attack/.meta/config.json index 3d7f952e9..135333f94 100644 --- a/exercises/practice/queen-attack/.meta/config.json +++ b/exercises/practice/queen-attack/.meta/config.json @@ -25,7 +25,8 @@ ], "files": { "solution": [ - "src/main/java/QueenAttackCalculator.java" + "src/main/java/QueenAttackCalculator.java", + "src/main/java/Queen.java" ], "test": [ "src/test/java/QueenAttackCalculatorTest.java" diff --git a/exercises/practice/queen-attack/src/main/java/Queen.java b/exercises/practice/queen-attack/src/main/java/Queen.java new file mode 100644 index 000000000..8cd04fb24 --- /dev/null +++ b/exercises/practice/queen-attack/src/main/java/Queen.java @@ -0,0 +1,7 @@ +class Queen { + + Queen(int row, int column) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} diff --git a/exercises/practice/queen-attack/src/main/java/QueenAttackCalculator.java b/exercises/practice/queen-attack/src/main/java/QueenAttackCalculator.java index 6178f1beb..b30a9d95e 100644 --- a/exercises/practice/queen-attack/src/main/java/QueenAttackCalculator.java +++ b/exercises/practice/queen-attack/src/main/java/QueenAttackCalculator.java @@ -1,10 +1,11 @@ -/* +class QueenAttackCalculator { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + QueenAttackCalculator(Queen queen1, Queen queen2) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + boolean canQueensAttackOneAnother() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/rail-fence-cipher/src/main/java/RailFenceCipher.java b/exercises/practice/rail-fence-cipher/src/main/java/RailFenceCipher.java index 6178f1beb..4cc76cd68 100644 --- a/exercises/practice/rail-fence-cipher/src/main/java/RailFenceCipher.java +++ b/exercises/practice/rail-fence-cipher/src/main/java/RailFenceCipher.java @@ -1,10 +1,11 @@ -/* +class RailFenceCipher { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + RailFenceCipher(int rows) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String getEncryptedData(String message) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/rectangles/src/main/java/RectangleCounter.java b/exercises/practice/rectangles/src/main/java/RectangleCounter.java index 6178f1beb..c3b7e4d2a 100644 --- a/exercises/practice/rectangles/src/main/java/RectangleCounter.java +++ b/exercises/practice/rectangles/src/main/java/RectangleCounter.java @@ -1,10 +1,7 @@ -/* +class RectangleCounter { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + int countRectangles(String[] grid) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. - -*/ +} \ No newline at end of file diff --git a/exercises/practice/rest-api/src/main/java/RestApi.java b/exercises/practice/rest-api/src/main/java/RestApi.java index 6178f1beb..325f18082 100644 --- a/exercises/practice/rest-api/src/main/java/RestApi.java +++ b/exercises/practice/rest-api/src/main/java/RestApi.java @@ -1,10 +1,21 @@ -/* +import org.json.JSONObject; -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. +class RestApi { -Please remove this comment when submitting your solution. + RestApi(User... users) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + String get(String url) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + String get(String url, JSONObject payload) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + String post(String url, JSONObject payload) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/robot-name/src/main/java/Robot.java b/exercises/practice/robot-name/src/main/java/Robot.java index 6178f1beb..ce9264952 100644 --- a/exercises/practice/robot-name/src/main/java/Robot.java +++ b/exercises/practice/robot-name/src/main/java/Robot.java @@ -1,10 +1,11 @@ -/* +class Robot { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + String getName() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + void reset() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file diff --git a/exercises/practice/robot-simulator/src/main/java/Robot.java b/exercises/practice/robot-simulator/src/main/java/Robot.java index 6178f1beb..3f73de5cd 100644 --- a/exercises/practice/robot-simulator/src/main/java/Robot.java +++ b/exercises/practice/robot-simulator/src/main/java/Robot.java @@ -1,10 +1,31 @@ -/* +class Robot { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + Robot(GridPosition initialPosition, Orientation initialOrientation) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + GridPosition getGridPosition() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ + Orientation getOrientation() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + void advance() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + void turnLeft() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + void turnRight() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + + void simulate() { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } + +} \ No newline at end of file diff --git a/exercises/practice/roman-numerals/src/main/java/RomanNumerals.java b/exercises/practice/roman-numerals/src/main/java/RomanNumerals.java index 6178f1beb..06dd749ed 100644 --- a/exercises/practice/roman-numerals/src/main/java/RomanNumerals.java +++ b/exercises/practice/roman-numerals/src/main/java/RomanNumerals.java @@ -1,10 +1,7 @@ -/* +class RomanNumerals { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + RomanNumerals(int number) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. - -*/ +} \ No newline at end of file diff --git a/exercises/practice/run-length-encoding/src/main/java/RunLengthEncoding.java b/exercises/practice/run-length-encoding/src/main/java/RunLengthEncoding.java index 6178f1beb..f54fc9a47 100644 --- a/exercises/practice/run-length-encoding/src/main/java/RunLengthEncoding.java +++ b/exercises/practice/run-length-encoding/src/main/java/RunLengthEncoding.java @@ -1,10 +1,11 @@ -/* +class RunLengthEncoding { -Since this exercise has a difficulty of > 4 it doesn't come -with any starter implementation. -This is so that you get to practice creating classes and methods -which is an important part of programming in Java. + String encode(String data) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -Please remove this comment when submitting your solution. + String decode(String data) { + throw new UnsupportedOperationException("Delete this statement and write your own implementation."); + } -*/ +} \ No newline at end of file