Question: #include #include #include #include using namespace std; class StudentInfo { private: string id; string lastname; string firstname; float gpa; int classes; public: void setid (string

#include #include #include #include using namespace std;

class StudentInfo { private: string id; string lastname; string firstname; float gpa; int classes; public: void setid (string id) { this->id = id; } void setlastname (string lastname) { this->lastname = lastname; } void setfirstname (string firstname) { this->firstname = firstname; } void setgpa (float gpa) { this-> gpa = gpa; } void setclasses (int classes) { this->classes = classes; } void display();

void setAll(string id, string firstname, string lastname, float gpa, int classes) { setid(id); setfirstname(firstname); setlastname(lastname); setgpa(gpa); setclasses(classes); }

string getid() { return id; }

string getlastname() { return lastname; }

string getfirstname() { return firstname; }

float getgpa() { return gpa; }

float getclass() { return classes; }

StudentInfo( string id3, string lastname3, string firstname3, float gpa3, int classes3) { id = id3; lastname = lastname3; firstname = firstname3; gpa = gpa3; classes = classes3; }

};

void StudentInfo::display() { cout

for(int i = 0; i

void addStudent( StudentInfo students[], int size) { string id, lastname, firstname; float gpa; int classes;

cout > id; students[size].setid(id);

cout > firstname; students[size].setfirstname(firstname);

cout > lastname; students[size].setlastname(lastname);

cout > gpa; students[size].setgpa(gpa);

cout > classes; students[size].setclasses(classes);

// displayall(students,size);

}

int main() { int count, choice; const int size = 4; char again = 'y'; string id,firstname,lastname; float gpa, classes;

StudentInfo students[size] = { StudentInfo ("AS123", "Peter", "Pan", 4.0, 45), StudentInfo ("AS124", "John", "Meyers", 4.0, 45), StudentInfo ("AS125", "Timothy", "Doe", 4.0, 45), StudentInfo ("AS126", "Sarah", "Mary", 4.0, 45) };

while (again == 'y') { cout > choice; choice = abs(choice);

while ( choice > 3) { cout > choice; choice = abs(choice);

}

switch (choice) { case 1: displayall(students, size); break; case 2: addStudent(students, size); break; case 3: cout

}

cout > again; again = tolower(again); cin.ignore(); cin.clear(); count = 0; system("cls"); } }

How would i add 2 members to the array object?#include #include #include #include using namespace std; class StudentInfo { private: string

A class allows a group of one or more member objects to have a series of common characteristics and functions. Create a class (student) that contains the member characteristics: 1. Student ID (string) 2. Student Last Name (string) 3. Student First Name (string) 4. GPA (float) 5. Number of enrolled classes (integer) The class functions are: 1. setlD (string passed to function to set Student ID) 2. setLastName (string passed to function to set Student Last Name) 3. setFirstName (string passed to function to set Student First Name) 4. setGPA (float passed to function to set GPA) 5. setClasses (integer passed to function to set Number of enrolled classes) 6. DisplayStudent (display member fields' values from within this function) 7. SetALL (strings, float and integer passed to function setting the appropriate field) Application will: 1. Create four class members (student1, student2, student3, student4) 2. Initialize the class members with the SetALL function 3. Display each member's individual characteristics 4. Allow user to enter a NEW class member, student5 or student6) 5. Allow user to run this repeatedly (some sort of menu presentation??) Output Example - Displaying the students' data: Student ID: AF101 Smith, Zachery H. 4 Classes Taken This Semester Current GPA is 3.2 Student ID: HJ389 Jones, Alias T. 2 Classes Taken This Semester Current GPA is 3.3 Student ID: KL209 Luzer, Emma P. 4 Classes Taken This Semester Current GPA is 4 Student ID: LL309 Beans, Hill O. 3 Classes Taken This Semester Current GPA is 2.5 Hit Any Key to continue

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 Databases Questions!