Output the integer which occurs least frequently


LeastFrequent - Output the integer which occurs least frequently along with its occurrence count from a list of 10 integers input from System.in. If multiple integers in the list occur least frequently, output any integer that occurs least frequently. Name your class LeastFrequent. You can assume that all 10 integers are in the range -100 to 100 inclusive. 

Examples: 
> javac LeastFrequent.java 
> java LeastFrequent 
numbers: 1 2 3 1 2 3 1 2 3 4 
least frequent: 4 occurs 1 times 
> java LeastFrequent 
numbers: 1 1 1 1 1 -1 -1 -1 -5 -5 
least frequent: -5 occurs 2 times 
> java LeastFrequent 
numbers: 10 9 8 7 9 8 7 9 8 7 
least frequent: 10 occurs 1 times

2-8.1b: Frequency 
Design and implement an application that reads an arbitrary number of integers that are in the range 0 to 50 inclusive and counts how many occurrences of each are entered. Stop reading input when any integer outside the range 0 to 50 is encountered. After all input has been processed, print all of the values (with the number of occurrences) that were entered one or more times. 
Prompt for input with System.out .print("enter numbers: "). 
The output should be one frequency count per line. For example: 
enter numbers: 2 2 5 5 5 5 5 5 2 5 -1 
3 occurrences of 2 
7 occurrences of 5 
enter numbers: 2 2 5 5 5 5 
5 5 2 5 -1 
3 occurrences of 2 
7 occurrences of 5 
SPECIFICATION OF NAMES: Please name your application class Frequency  

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Output the integer which occurs least frequently
Reference No:- TGS081983

Expected delivery within 24 Hours