Question: write an interactive menu-driven program that will perform various arithmetic calculations. A menu of different calculations will be shown to a user at the beginning
write an interactive menu-driven program that will perform various arithmetic calculations.
A menu of different calculations will be shown to a user at the beginning of the program (and again after each calculation). The user will select an option and the program will then prompt for additional information that is specific to the calculation, perform the actual calculation, and display the result. This process will continue until the user decides to quit.
The Arithmetic Calculations
The calculations that will be available to the user are:
-
finding the larger of two floating point numbers
-
determining if one integer number is divisible by another integer number
-
raising a real number (M) to an integer power (N) - M to the Nth power
-
calculating the factorial of an integer number. The factorial is the product of all integers from 1 to the integer. The exception is 0! which is equal to 1.
Sample Output:
Make a selection from the list below. L) Find the 'L'arger of 2 numbers D) Check if an integer is 'D'ivisible by another integer P) Find the value of the expression, M to the Nth 'P'ower F) Find the value of a 'F'actorial Q) 'Q'uit What would you like to do? L What is the 1st number? 11.8 What is the 2nd number? 30.1 The largest value is 30.1 Make a selection from the list below. L) Find the 'L'arger of 2 numbers D) Check if an integer is 'D'ivisible by another integer P) Find the value of the expression, M to the Nth 'P'ower F) Find the value of a 'F'actorial Q) 'Q'uit What would you like to do? m m is not a valid choice Make a selection from the list below. L) Find the 'L'arger of 2 numbers D) Check if an integer is 'D'ivisible by another integer P) Find the value of the expression, M to the Nth 'P'ower F) Find the value of a 'F'actorial Q) 'Q'uit What would you like to do? T T is not a valid choice Make a selection from the list below. L) Find the 'L'arger of 2 numbers D) Check if an integer is 'D'ivisible by another integer P) Find the value of the expression, M to the Nth 'P'ower F) Find the value of a 'F'actorial Q) 'Q'uit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
