Simple Calculator
Example User Interaction¶
Welcome to Calculator. What is the first number? 42
What is the second number? 8
Do you want to add, subtract, multiply, or divide? divide
42 / 8 equals 5.25
User Story 0¶
Create a program with a main method.
User Story 1¶
Prompt the user to enter the two numbers, and use Scanner.nextDouble() to read their input into two variables.
Prompt the user to input which calculator function they want to perform, and read their response into a String variable.
User Story 2¶
Using if/else statements, perform the requested calculation, storing the result in a variable and print the results.
User Story 3¶
If the user enters an invalid calculator function, print an error message.
User Story 4¶
Modify your if conditions to accept different forms of input for the calculation. For example, if the user enters either add or plus or +, perform addition; use a single if or else if to achieve this.