{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ITP109_Lab5

# ITP109_Lab5 - for loop Display the result In mathematics...

This preview shows pages 1–2. Sign up to view the full content.

ITP 109 Lab 5 Goal You will practice using switch statements and loops. Assignment Create a new project called Lab5 and a new Java class called Loops . In the main method, use a while and a switch to create a menu that looks something like: Please enter one of the following choices: 1 --> Largest Number 2 --> Factorial -1 --> Quit For the Largest Number, you will read a list of integers and determine the largest integer. Using a while loop, ask the user to input an integer or -1 to quit. When the -1 has been entered, display the largest number. For the Factorial, ask the user to input an integer and then calculate its factorial by using a

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for loop. Display the result. In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5 ! = 1 x 2 x 3 x 4 x 5 = 120 and 6 ! = 1 x 2 x 3 x 4 x 5 x 6 = 720. • Use the Scanner class to get input from the user, and use System.out to print to the console window. • Make sure to comment your code. Grading - 30 points total • 10 points: Menu (while & switch) • 10 points: Determining and displaying the largest number • 10 points: Determining and displaying the factorial • If you do not comment your code, points will be deducted....
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern