Write a C++ program (or Java program) called hw1_1.cpp (or hw1_1.java) that reads input numbers from a user and displays the number that occurs most frequently among all the input numbers.
Input format: This is a sample input from a user.
5
7
-7
20
7
15
The first number (= 5 in the example) indicates that there will be five integer numbers in the input. Then, all numbers from the second line (= 7 in the example) to the last line (15 in the example) are actual numbers. Thus, your program should read them and display the most frequent number among 7, -7, 20, 7, and 15. Because the number 7 appears twice in the input, your answer should be 7. If you have more than one number that occurs most often, you have to display the largest number.
Sample Run 0: Assume that the user typed the following lines.
5
7
-7
20
7
15
This is the correct output of your program.
Number:7
Frequency:2
Sample Run 1: Assume that the user typed the following lines.
10
-1
20
-15
5
72
20
5
20
5
30
This is the correct output of your program. Note that the frequencies of 5 and 20 are 3. But since 20 is bigger than 5, the correct number should be 20.
Number:20
Frequency:3
Sample Run 2: Assume that the user typed the following lines.
2
2
1
This is the correct output of your program.
Number:2
Frequency:1