Question: Within DrJava, create a class called NumberOperations and do the following. Have the user be able to enter two integer numbers from the keyboard. Display
Within DrJava, create a class called NumberOperations and do the following. Have the user be able to enter two integer numbers from the keyboard. Display to the user a menu of options that they can choose from to perform an action on these two numbers. For example, if the user entered two integer numbers such as 11 and 3, respectively, display something like the following:
Please select operation type for 11 and 3
1 - add these two numbers
2 - subtract the second number from the first number
3 - multiply both numbers
4 - integer division (first number / second number)
5 - floating point division (first number / second number)
6 - Exit
The user will select one of these actions and then your code will perform the appropriate action using the two numbers and print out the answer. The user will continue to select any of these actions as long as they wish. If the user selects a number that is not valid, then print out an error message but allow the user to select another action. The user will end the program by selecting the number 6 (i.e. Exit). An appropriate error message could be something like this: ***ERROR*** 7 is not a valid selection. Please try again!
Make sure that you import the class Scanner Do not forget to prompt the user where appropriate Print out your first and last name stating that you wrote this program Print out End of program. as the last line in your program For all print outs in your program you are to use System.out.printf You are to use comments throughout your program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
