This is the most interesting activity of a programmer's profession. And that is the purpose of this book – to help you write Java code well.
Let's start with the requirements for your first application. It should take an integer number as an input, multiply it by 2, and print the result in the following format: <the input number> * 2 = <result>.
Now, let's come up with the design. We will create the SimpleMath class with the multiplyByTwo(int i) method that will accept an integer and return the result. This method will be called by the main() method of the MyApplication class. The main() method should:
- Receive an input number from a user
- Pass the input value into the multiplyByTwo(int i) method
- Get back the result
- Print it on a screen in the required format
We will also create tests for the multiplyByTwo(int i) method...