Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

Students also viewed these Databases questions

Question

What exactly does it mean when we say that oxygen boils at - 183C?

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago