Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: http://solutionzip.com/downloads/mathoptions-java-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.
- Download: http://solutionzip.com/downloads/mathoptions-java-switchoption-java/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement