Need a Java program that reads the integers between 1 and 100 and counts the occ
ID: 3651639 • Letter: N
Question
Need a Java program that reads the integers between 1 and 100 and counts the occurrences of each. Assume the input ends with 0. For example this complete list of numbers would all be entered all at the same time: 2 5 6 5 4 3 23 43 2 0 Then the "Enter" key hit to send to the program. The program then displays the out put as:2 occurs 2 times
3 occurs 1 time
4 occurs 1 time
5 occurs 2 times.....
Note that "times" is singular or plural as needed. There is not GUI for this code. All is by command line.
This problem is from Liang's Intro. to Java Chapter 6, Exercise 3. Thanks!
Explanation / Answer
anArray[] = new anArray[ 100 ]; int i; // to fill array with 0 for( i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.