Write a class encapsulating the concept of converting intege
Write a class encapsulating the concept of converting integer grades to letter grades (A, B, C, D, or F), assuming grades are composed of a list of integers between 0 and 100 (instance variable). Write the following methods: • A constructor with just one parameter, the number of students; all grades can be randomly generated. • Accessor, mutator, toString, and equals methods. • A method returning an array of chars corresponding to the integer grades (90 or above should be converted to A, 80 or above to B, 70 or above to C, 60 or above to D, and 59 or less to F). • A method returning the number of A’s. • A method returning an array of int counting how many A’s, B’s, C’s, D’s, and F’s were received. Write a client class to test all the methods in your class.
Solution
Please find the required program along with its output. Please see the comments against each line to understand the step
-------------------------------------------------------
OUTPUT:
Grade 1: Grade{grades=[40, 23, 84, 16, 49, 92, 64, 55, 85, 55, 89, 21, 23, 89, 51, 25, 91, 38, 63, 74, 71, 96, 87, 32, 69, 15, 54, 98, 17, 46, 12, 87, 36, 64, 37, 20, 48, 41, 15, 62, 54, 11, 83, 99, 12, 9, 79, 0, 11, 86]}
Grade 2: Grade{grades=[95, 92, 97, 57, 92, 85, 56, 4, 44, 60, 4, 46, 26, 11, 78, 54, 61, 25, 24, 55, 71, 56, 11, 25, 35, 59, 99, 3, 88, 63, 82, 11, 43, 54, 22, 56, 10, 80, 52, 68, 15, 89, 7, 34, 14, 14, 8, 17, 99, 20]}
Grade 1 == Grade 2 : false
Letter grades of Grade 1 : [F, F, B, F, F, A, D, F, B, F, B, F, F, B, F, F, A, F, D, C, C, A, B, F, D, F, F, A, F, F, F, B, F, D, F, F, F, F, F, D, F, F, B, A, F, F, C, F, F, B]
Count of A\'s in Grade 1 : 5
Count of grades in Grade 1 : [5, 8, 3, 5, 29]
.
