Question: *****JAVA***** Written in Java. The mode is a statistical summary of data (as are min, max, and average) representing the most commonly occurring value. Given

Written in Java. The "mode" is a statistical summary of data (as are min, max, and average) representing the most commonly occurring value. Given 10 integers ranging from 0 to 99, output the mode and its frequency. If the input is 11112298 76, the output is: 14 If any integer is outside 0-99, output an error. If an input is 105, the output is: Invalid input: 105 is not in 0-99 Hints: Knowing that integers are in 0-99 enables creating an array with 100 elements to count the occurrences of each value. Traverse the user Values array and keep count by incrementing the appropriate element in a counts array. If the input is 27, then increment element 27's value. While traversing user Values, check for an integer outside the range. If found, print the error message, and immediately stop the program. After done counting, use another loop to traverse the counts array and find the max. Also keep track of the index where max was found. 1 import java.util.Scanner; 2 3 public class Main { 4 public static void main(String[] args) { 5 Scanner scnr = new Scanner(System.in); 6 7 int() userValues = new int[19]; indlyi; 9 10 for (i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
