Question: Write a program that reads a list of integers from input and identifies the mode (the value that appears most often). The input is

Write a program that reads a list of integers from input and identifies the mode (the value that appears most often). The input is a sequence of integers that ends with -1. All other integers in the list are between 1 and 20 (inclusive). Total number of integers in the list is unknown. Output the mode and end with a newline. Assume that the list is not empty and only one mode exists. Hint: Use an array to count the number of occurrences of 1-20. See comment in starter code. Ex: If the input is: 59 22 14 5 5 -1 the output is: 5 407454 2728764 qx3y7 LAB ACTIVITY 5.24.1: LAB: Find mode 1 import java.util.Scanner; 2 3 public class LabProgram ( 4 5 public static void main(String[] args) { Scanner scnr new Scanner(System.in); LabProgram.java 0/10 Load default template..... Activa Go to Se C coding need M Gmail X zy Section 5.24 X G Write a progra X zy Section 5.24 X G Write a progra X https://learn.zybooks.com/zybook/DELTACOLLEGECSP026AMaumalangaFall2022/chapter/5/section/24 54F Sunny YouTube Maps Translate 5 407454.2738764.qx3zqy7 LAB ACTIVITY = zyBooks My library > CSP 026A: Java Programming home > 5.24: LAB: Find mode 5 6 7 News 8 1 import java.util.Scanner; 2 3 public class LabProgram 4 9 10 11 12 13 14} Acting Essay } 5.24.1: LAB: Find mode School public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Delta College Develop mode Submit mode Enter program input (optional) Java program Theapy LabProgram.java Mean Median X H Coding Coding deltacollege X /* numCount [] counts the number of occurrences for values 1-20 in the corresponding array index. Items in index are ignored */ int[] numCount = new int[21]; /* Type your code here. */ A Math and Scie X CodeStack Academy P Master of Science i... zyBooks catalog ? Help/FAQ 0/10 Load default template... Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. + ID X : Other bookmarks 8:48 AM 10/21/2022 Kaiden Gibson
Step by Step Solution
There are 3 Steps involved in it
Here is a possible solution for the given problem import javautilScanner public class LabProgram pub... View full answer
Get step-by-step solutions from verified subject matter experts
