Question
: Write a Java program that given a collection of N numbers will find the largest value, the frequency of the largest value (i.e., the
: Write a Java program that given a collection of N numbers will find the largest value, the frequency of the largest value (i.e., the number of times the largest value appears in the collection), and the average of the N numbers
Get the value of N from the user.
If N
Read the values as entered from the user. (If N =5, then there are 5 values the user is going to enter).
Find the Largest, the frequency of the largest value, and the average of these N values.
solution must not use arrays and data files.
Hint: To find the largest value, read the first value before the loop then assume that this first value entered by the user is the largest value and its frequency is 1. Within the loop compare the assumed largest value with other values read inside the loop and change the largest value and frequency accordingly.
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