Question: Write a class that calculates add, subtraction, and multiplication. The class should include the following methods: Constructor : initialize all values to 0 getAsk() :
Write a class that calculates add, subtraction, and multiplication. The class should include the following methods:
Constructor : initialize all values to 0
getAsk() : Ask users to input two integer numbers. This mehod calls
Distribute() method. Distribute() : Ask users to choose which calculation he/she wants. This method calls a method that can add, subtract, or multiply based on the user's option.
CalAdd() : add two numbers
CalSub() : subtract two numbers
CalProduct() : multiply two numbers
toString() : toString method that display result of operation.
The program should be designed to test the class developed. Your program might look like the following:
public class CalculateNumTesting {
public static void main(String[] args) {
CalculateNum calculation = new CalculateNum();
calculation.getAsk();
System.out.println(calculation);
}
}
The actual output of the program looks like following:

65 C:\Windows\system32\cmd.exe Enter first number: 4 Enter second number: 3 Which one do you want? A: add S: subtract M: multiplication >> M The result of the calculation is 12.0 Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
