ITP109_Lab5

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

This preview shows page 1. 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 Lab5 . 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 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 - 15 points total 5 points: Menu (while &amp; switch) 5 points: Determining and displaying the largest number 5 points: Determining and displaying the factorial If you do not comment your code, points will be deducted....
View Full Document

Ask a homework question - tutors are online