Additional Practice
Code challenge 1
Write the code for the alternative constructor, then write the main() method to accept input from the user through the keyboard and invoke the object using these values
Answer
Code challenge 2
Write a class called Calculator. The program will accept two numbers from the user through the keyboard and provide a list of mathematical operations which must be performed on the two number provided. The program then provides the result to the user on the screen. The available mathematical operations are as follows:
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Modulus (%)
The method must make use of the switch statement to perform the operations