Question: Create a class named Student Add a private static attribute named numStudents and make sure to assign it to zero properly. Add the followingprivate data
Create a class named Student
Add a private static attribute named numStudents and make sure to assign it to zero properly. Add the followingprivate data members: firstName (String), lastName (String) and grades (int[4])
Create public methods:
getGPA that returns a double of the average of the values in the grades array.
A default constructor that increase the numStudents member by one and assign proper values to the data members.
An overloaded constructor that takes three arguments (fName, lName, int[]) and assigns them to the local private variables. Be sure to increase the numStudents static data member by one as well.
A method to Display data members of Student Object
A static function to return the value of the numStudents static data member.
Make sure to use MIL with each constructor including the array data member.
The main function:
In the main function, create student1 Object by calling the overloaded constructor for the student Sammy Haggar. Setthe grades array with the values {4, 2, 3, 3}
Create another Student object and assign the data members to any values you choose. Display each object data member values and follow that with printing the number of created objects.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
