Question
JAVA Instructions Factorial Calculator Create an application that calculates the factorial of the number entered by the user. Console Welcome to the Factorial Calculator Enter
JAVA
Instructions
Factorial Calculator
Create an application that calculates the factorial of the number entered by the user.
Console
Welcome to the Factorial Calculator
Enter an integer that's greater than 0 and less than 100: 3
The factorial of 3 is 6.
Continue? (y/n): y
Enter an integer that's greater than 0 and less than 100: 4
The factorial of 4 is 24.
Continue? (y/n): y
Enter an integer that's greater than 0 and less than 100: 9
The factorial of 9 is 362880.
Continue? (y/n): n
Specifications
The exclamation point is used to identify a factorial. For example, the factorial of the number n is denoted by n!. Heres how you calculate the factorial of the numbers 1 through 5:
1! = 1 which equals 1 2! = 1 * 2 which equals 2 3! = 1 * 2 * 3 which equals 6 4! = 1 * 2 * 3 * 4 which equals 24 5! = 1 * 2 * 3 * 4 * 5 which equals 120
Use a for loop to calculate the factorial.
Assume that the user will enter valid numeric data for the length and width.
Use the long type to store the factorial.
The application should continue only if the user enters y or Y to continue.
Input
An integer using a string prompt
Processing
Calculate the factorial of the entered number using the formula above.
Output
Print the result statement
The result statement should include the user entered number and the factorial of the number
Offer user another chance to enter another number or to exit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started