Question: (1) Write a Java program that prompts the user to enter an integer number, then it computes its factorial. The integer number should be typed

(1) Write a Java program that prompts the user to
(1) Write a Java program that prompts the user to enter an integer number, then it computes its factorial. The integer number should be typed in by the user in response to a prompt message Hint: The factorial of a number n can be recursively defined as follows: !n*(n-1), where > Explanation: 01 - 1 Factorial of 0 is 1. 1 - 1 Factorial of lis 1. 2! - 2x1-2 Factorial of 2 is 2. 3! - 3x2x1 -6 Factorial of 3 is 6 4! - 4x3x2x1-24 Factorial of 4 is 24 m! - x - 1)*(1-2)...3x2x Factorial ofn is the product of nx(n-1)(-2)... 321 Your program must consider the following specifications: Use Factorial as the name of your class Type your name and student number above the class declaration using a block/paragraph comment Use documentation, comments and code style, Use significant and appropriate identifiers, Use appropriate data type for the variables. . Use long type to hold the result of the factorial. Here are sample runs of the program: Enter a number: 5 The factorial of 5 is 120 Enter a number: 0 The factorial of 0 1 1 Enter a number: The number cannot be negative

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!