Question: Write a C + + program that creates a class Student which has the following private attributes: ID ( int ) , name ( string

Write a C++ program that creates a class Student which has the following private attributes: ID (int), name (string), GPA (float) and phoneNumber (string). The class should contain the following public functions:
setID (int id) to set the ID value
setName (string name) to set the name value
setGPA (float gpa) to set the GPA value
setphoneNumber (string number) to set the phoneNumber value
int getID() to get the ID value
string getName() to get the name value
float getGPA() to get the GPA value
string getphoneNumber() to get the phoneNumber value
void displayStudentInfo() to display the student info as: "The student ID is 122232, name is Mark, GPA is 3.90, and phone number is 306338560" using the getter functions (e.g., getID).
Then, create 3 student objects, ask user for information and display their information on the screen. Here are the steps: write a loop that iterate 3 time and, in each iteration,
Create an object of the Student class
Ask user for information (e.g. ID) and use the setter functions (e.g., setID) to set the values of the student objects
Displays the student information stored using the displayStudentInfo() function, each one per line.
Write a C + + program that creates a class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!