Step 1: Write an application that prompts the user two integers
Step 2: Prompt the user to enter an option 1-4. See below for the definition of the options.
1. Add the two integers
2. Subtract the second integer from the first
3. Multiply the integers
4. Divide the first integer by the second. See step 3 for additional instructions.
Display the results of the arithmetic.
Step 3: Display an error message if the user enters an option other than 1 through 4 or if the user chooses the divide option but enters 0 for the second integer. Please note a use of a nested if will be needed to determine if the second integer is 0.
Step 4: Debug and save the class as MathOptions.java
Step 5: Delete the if…. else statements that currently determine which number the user entered, and then replace them with a switch structure.
Step 6: Debug and save the class as SwitchOption.java
Additional notes: Include comments to reflect each step above.
Write a Review
Leave a reply Cancel reply
Ask Your Question
We have verified professionals who are ready to answer your question.
Save Time and Money
We choose experts who can quickly answer your question and that suit your budget.
Get Your Answer
Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.