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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started