Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I cannot add the new class memebr, I dont know what kind of errors in my case 3. Please help to solve the case3 in

I cannot add the new class memebr, I dont know what kind of errors in my case 3. Please help to solve the case3 in my code.

image text in transcribed

#include

#include

#include

#include

using namespace std;

class student

{

private:

string studentid;

string studentlastname;

string studentfirstname;

float studentgpa;

int num_class;

public:

void setID(string);

void setLastName(string);

void setFirstName(string);

void setGPA(float);

void setClasses(int);

void displayStudent();

void setALL(string, string, string, int, float);

};

void student::setID(string id)

{

studentid = id;

}

void student::setLastName(string lastname)

{

studentlastname = lastname;

}

void student::setFirstName(string firstname)

{

studentfirstname = firstname;

}

void student::setClasses(int numclasses)

{

num_class = numclasses;

}

void student::setGPA(float gpa)

{

studentgpa = gpa;

}

void student::displayStudent()

{

cout

cout

cout

cout

}

void student::setALL(string id, string lastname, string firstname, int numclasses, float gpa)

{

studentid = id;

studentlastname = lastname;

studentfirstname = firstname;

num_class = numclasses;

studentgpa = gpa;

}

int main()

{

int current_record = 4;

int const max = 6;

int option, option_1;

bool again = true;

string str;

student student1;

student1.setALL("AF101", "Smith", "Zachery H.", 4, 3.2);

student student2;

student2.setALL("HJ389", "Jones", "Alias T.", 2, 3.3);

student student3;

student3.setALL("KL209", "Luzer", "Emma P.", 4, 4);

student student4;

student4.setALL("LL309", "Beans", "Hill O.", 3, 2.5);

student record[] = {student1, student2, student3, student4};

while (again)

{

system("cls");

cout

cout

cout

cout

cout

cout

cin >> option;

option = abs(option);

switch (option)

{

case 1:

{

system("cls");

cout

cin >> option_1;

option_1 = abs(option_1);

while (option_1 > 4 || option_1

{

cout

cout

cin >> option_1;

}

cout

record[option_1 - 1].displayStudent();

cout

getch();

break;

}

case 2:

{

system("cls");

cout

cout

for(int n = 0; n

{

record[n].displayStudent();

cout

}

cout

getch();

break;

}

case 3:

{

char again = 'y';

while (again == 'y');

{

system("cls");

int i = current_record;

i++;

cout

cout

record[i+1].setID();

cout

record[i+1].setLastName();

cout

record[i+1].setFirstName();

cout

record[i+1].setClasses();

cout

record[i+1].setGPA();

cout

record[i+1].displayStudent();

cout

cin >> again;

again = tolower(again);

break;

}

}

case 4:

{

system("cls");

cout

getch();

exit(0);

break;

}

default:

{

system("cls");

cout

getch();

}

}

}

system("cls");

}

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. 2. 3. 4. 5. Student ID (string) Student Last Name (string) Student First Name (string) GPA (float) Number of enrolled classes (integer) The class functions are 1. setID (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 GPAis 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

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

Step: 3

blur-text-image

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions