Question
Objective: At the end of the exercise, the students should be able to: Write programs that execute statements repeatedly; Implement program control with break and
Objective: At the end of the exercise, the students should be able to: Write programs that execute statements repeatedly; Implement program control with break and continue; and Create nested loops.
Materials: NetBeans IDE 8.2 Java Development Kit (JDK) 8
Instructions: 1. Create a folder named LastName_FirstName (ex. Diaz_Jess) in your local drive. 2. Using NetBeans IDE, create a new project. 3. Name the class as FactorialCalculator and save the project in your folder 4. Write a simple factorial calculator program. The program should perform the following: Step 1. Ask the user to enter a positive integer. Step 2. Check if the entered integer is positive or negative. If it is positive, perform Step 3; otherwise, display an appropriate error message and the program should stop. Step 3. Calculate the factorial of the entered positive integer and display the result.
Note: The factorial of n is denoted by n! and calculated by the product of integer numbers from 1 to n. For example, the entered integer is 5, the calculation of its factorial is: 5! = 1 2 3 4 5 = 120.
Step 4. Repeat Step 1 to Step 3 five (5) times.
5. Compile and execute the program. 6. Debug syntax and logical errors if there is any in the program.
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