Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions Write a class called Factorial to finish the following task. Compile and run the program. Next create a folder and name it with the
Instructions Write a class called Factorial to finish the following task. Compile and run the program. Next create a folder and name it with the course, section, lab number, and your name. Example: csit111_02_lab jane. Copy Factorial.java to this folder. Last, zip the folder and submit it to Canvas before the given deadline for grading Background The the factorial of an integer n is the product of all numbers from 1 to n and is written n So 5!-5*4*3 * 21 120 By definition, 0 Specifications Write a program that asks the user for an integer. If the integer is greater than or equal to 0, the program calculates the factorial of that number and prints that value. If the number entered is negative, the program prints an error message and quits main Method The main method must create a Scanner object, ask the user for an integer, and use the Scanner object to get a input from the user. If the input is negative, an error message is printed. If the input is not negative, the main method should call the factorial method to get the factorial of the integer entered by the user. And print the value returned by the factorial method
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