Question: Write a JAVA program to read in positive integers until a negative value is entered, then it processes the values except for the last negative
Write a JAVA program to read in positive integers until a negative value is entered, then it processes the values except for the last negative value and displays the largest value, smallest value, and the average of the entire values.
Ex)
Output:
Please enter a positive integer, or -1 to quit.
Input: 1
Output:
Please enter a positive integer, or -1 to quit.
Input: 2
Output:
Please enter a positive integer, or -1 to quit.
Input: 3
Output:
Please enter a positive integer, or -1 to quit.
Input: 4
Output:
Please enter a positive integer, or -1 to quit.
Input: -1
Output:
For the 4 numbers you entered
the largest value = 4
the smallest value = 1
and the average is = 2.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
