MathOptions.java & SwitchOption.java

Download Category:

MathOption & SwitchOption.zip - (189.36 KB)
[
MathOption & SwitchOption/MathOptions/
MathOption & SwitchOption/MathOptions/.classpath
MathOption & SwitchOption/MathOptions/.project
MathOption & SwitchOption/MathOptions/MathOptions.class
MathOption & SwitchOption/MathOptions/MathOptions.java
MathOption & SwitchOption/Question.txt
MathOption & SwitchOption/Screenshot_1.png
MathOption & SwitchOption/Screenshot_2.png
MathOption & SwitchOption/SwitchOption/
MathOption & SwitchOption/SwitchOption/.classpath
MathOption & SwitchOption/SwitchOption/.project
MathOption & SwitchOption/SwitchOption/SwitchOption.class
MathOption & SwitchOption/SwitchOption/SwitchOption.java
]

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

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.