Question: Problem description:I n Java Write a program that takes a positive integer from user (use JOptionPane class for both input and output). The program outputs

Problem description:I n Java Write a program that takes a positive integer from user (use JOptionPane class for both input and output). The program outputs the factorial of that integer. The factorial of the integer n is n * (n-1) * (n-2) * * 3 * 2 * 1. For instance, the factorial of 4 is 4 * 3 * 2 * 1 = 24. Your program should allow the user to continue entering different integers for the calculation until -1 is entered. Write the prompt clearly. Note: 1) You dont need to handle the wrong input type such as a string. But for any negative integer except -1, you should allow the user to re-enter the input. 2) Must use a for loop to calculate the factorial. 3) This program needs nested loops. The outer loop controls the entering input data (positive integer: output the factorial and prompt user for another input; -1: finish the program; other negative integer: prompt user to enter a correct input). The inner for loop calculates the factorial of each input data.

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 Databases Questions!