ITP109_Lab5

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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

Page1 / 2

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

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online