In: Computer Science
Ch 4 Program 4A: Factorial.java
Please adhere to the Standards for Programming Assignments and the Java Coding Guidelines.
Write a program that computes the factorial of a number that is
input from the user.
A factorial is the product of all the numbers up to the number entered.
For example, 6-factorial is 720 because 6*5*4*3*2*1 is 720.
Six-factorial is written as 6!
Prompt the user for the numeric input between 1 and 10.
Do not accept numbers greater than 10 or less than 1.( Check out the input/data Validation page on Canvas in module 4B)
Calculate and display the factorial. All code must reside in the main() method
Do not use any concept that is not covered in class.
Include output from this Test Data: 22
7
1
Example Output with Valid inputs: *******Factorial********* Please enter a value between 1-10: 5 5! = 120 Goodbye!! Example Output with an Invalid input: *******Factorial********* Please enter a value between 1-10: 12 Value is out of range. Please Re-enter a value between 1-10 : 17 Value is out of range. Please Re-enter a value between 1-10 : 8 8! = 40320 Goodbye!! |