1.In this lab you will gain experience using classes and arrays of classes. Use the following as the beginning of a student abstract data type.

public class Student
{
private String fName ;
private String lName ;
private double[] grades;
}

This class should be in the package com.csc241. Write a program that prompts a user for a total number of students and dynamically allocates memory for just that number of Student objects in a Student[]. Then continuously re-prompt the user to enter, on a student by student basis,

i.a student's first and last name to be used in populating the class data members fName and lName with appropriate set methods. Use local String variables to hold the values entered by the user.

ii.the number of grades for the student to be stored in nGrds, a local variable of the main program. Next,

iii.dynamically allocate memory for the grades and assign the resulting reference to a local double[]. Prompt the user for the nGrds values and after acquiring them all, assign the local grades array to the Student instance in the array using an appropriate set method.

iv.re-use the MaxMin class you wrote in a previous lab, but also put it in the package com.csc241. Similarly, the GradeCalculator class that you created in the last assignment needs to be in the com.csc241 package. You will be using the avg and maxMin static methods that accept the grades[] in order to compute individual student statistics.

v.In order for you to calculate ensemble statistics, that is statistics for the entire class, the GradeCalculator class will need methods avg and maxMin that accept as an argument the Student[] that you dynamically allocated. These methods must loop through the individual grades[] of each Student array element in order to compute the total class average, max and min values.

vi.display the results to the user, both on a per student and ensemble basis. Your output should appear as shown below. Please make note of and reproduce all the decimal formatting and other characteristics of the sample output.

As always, keep in mind all of the general rules of good program construction.

How many students are in your class - 3

Enter the first name of student #1 - Mike

Enter Mike’s last name - Graz

How many grades will you be entering for Mike Graz? – 5

Plz enter the grades for Mike Graz
100
97
87
87
92
Grade Statistics for Mike Graz (average=92.6 ; max/min=100/87)

Enter the first name of student #2 - Jack

Enter Jack’s last name - Schwartz

How many grades will you be entering for Jack Schwartz? – 3

Plz enter the grades for Jack Schwartz
100
90
0
Grade Statistics for Jack Schwartz (average=63.3 ; max/min=100/0)

Enter the first name of student #3 - Joan

Enter Joan’s last name - Jameson

How many grades will you be entering for Joan Jameson? – 4

Plz enter the grades for Joan Jameson
98
95
93
94
Grade Statistics for Joan Jameson (average=95.0 ; max/min=98/93)

Ensemble Statistics - Average=86.1 ; Max/Min=100/0)

Do you wish to continue (Y/N) - n
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.