In this exercise, you will use java methods to solve a series of problems. You will use provided unit tests to verify that your solutions are correct.
There are two sets of required exercises in this project: Calculator
and StringUtilities
. You will find the
exercises in the src/main/java/org/example/
directory.
Note
You may notice that the build is broken when you open the project and there are errors showing. This is because the methods are not yet implemented and the tests are referencing methods that do not exist. This is expected and you will fix this by implementing the methods.
Tip
We will soon be learning to write our own tests, but for now, you may want to look at the code for the provided tests to see how they work and for some clues about how to implement the methods for exercises in this project.
You will find the calculator exercises in the src/main/java/org/example/Calculator.java
file.
This class is empty other than comments explaining the four methods you need to implement. Each method is a calculator operation. Follow the instructions in the comments to implement the methods.
Once you have completed the exercises, run the tests in the src/test/java/org/example/CalculatorTests.java
file to verify that your solutions are correct.
To run these tests, right-click on the CalculatorTests
class and select Run 'CalculatorTests'
.
You will see the results of the tests in the Run
tab at the bottom of the IDE.
You will find the string utilities exercises in the src/main/java/org/example/StringUtilities.java
file.
This class is empty other than comments explaining the methods you need to implement. Each method is a string utility operation. Follow the instructions in the comments to implement the methods.
Tip
Refer to the Java Basics 1 course for information on common String methods.