CMPSC-F132 Assignment 5
Due: Saturday 3/2/2019 11:59pm ET
Homework assignments are individual assignments. Also, you must abide by the academic integrity policy as determined by the school and mentioned in the course syllabus.
Please upload your source code to Blackboard. Remember to only submit the .java file(s)
For this assignment you are required to write 3 java programs. Therefore, you need to create 3 classes and submit 3 .java files (one for each problem). Here are the descriptions of the problems:
[30 points] Create a class called HW05P1. In the main method write a program that generates 100 random integers between 0 and 9 and displays the count for each number. (Hint: use an array of 10 integers to store the counts for the number of 0s, 1s,…,9s).
[30 points] Create a class called HW05P2. Inside the class write a method with the following header to find the minimum element in an array of double values:
public static double min(double array)
Write a test program in your main method to prompt the user to enter 10 numbers, invoke the method to return the minimum value, and display it. Here is a sample input-output:
Enter 10 numbers: 1.9 2.5 3.7 2 1.5 6 3 4 5 2.4
The minimum number is 1.5
[40 points] Create a class called HW05P3. Inside the class write a program that reads 10 numbers from input and displays the number of distinct numbers, as well as the distinct numbers in their input order, separated by space (if a number appears multiple times, it should be displayed only once). Hint: read a number and store it into an array if it is new. If the number is already in the array, ignore it. Here is a sample input-output:
Enter 10 numbers: 1 2 3 2 1 6 3 4 5 2
The number of distinct numbers is 6
The distinct numbers are: 1 2 3 6 4 5