Due Fri 9/27 or Sat 9/28 (Depending on lab session day)
Implement a simple java calculator using Switch statements and while loops
Create a program that continuously prints a menu of options for the user to select from, the options are addition, subtraction, multiplication, division, modulus, factorial and an option for the user to exit the program.
Ask the user to select an option if they wish to complete a mathematical operation prompt the user for the two numbers and perform the operation they choose
If the user selects to exit the program exit the loop and terminate the program.
Implement factorial using a for loop:
Factorial is the product of all the numbers from 1 to n:
5 factorial (5!) is : 5 * 4 * 3 * 2 * 1 = 120
4 factorial (4!) is : 4 * 3 * 2 * 1 = 24
A loop is used to repeat actions. In this case we want to multiply a series of numbers repeatedly to compute the factorial .
Pointers:
How to respond if a user enters an option that is not on the list?
If user chooses to divide by zero how can you handle that?
If a user enters factorial option you only need to take in one number not two how can you use if statements to handle that change?
Make sure to preform input validation when needed