Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago

Question

What is the environment we are trying to create?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago