Question: Write a program with a loop that lets the user enter a series of integers. The user should enter 99 to signal the end of

Write a program with a loop that lets the user enter a series of integers. The user should enter 99 to signal the end of the series. After all the numbers have been entered, the pro-gram should display the largest and smallest numbers entered. program is in JAVA.

please help me check my program. The output for largest value shown below is not correct.

public static void main(String[] args) { Scanner input = new Scanner(System.in); int value; int smallest; int largest = 0; System.out.println("Instructions: if you would like to stop, enter -99"); System.out.print("Enter a number: "); value = input.nextInt(); smallest = value; while(value != -99){ System.out.print("Enter a number: "); value = input.nextInt(); if(value!=-99) { if (value > largest){ largest = value; } if (value

OUTPUT:

Instructions: if you would like to stop, enter -99 Enter a number: 100 Enter a number: 88 Enter a number: 7 Enter a number: 98 Enter a number: -99 Smallest Value: 7 Largest Value: 98

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!