Question
C++ Introduce a Student class with the following data members: string name, char gender, and double gpa. Introduce a constructor for Student class and setter
C++
Introduce a Student class with the following data members: string name, char gender, and double gpa.
Introduce a constructor for Student class and setter and getter functions for the data members. Note that you are requested to check the valid values of each data member. Namely, name cannot be empty string, gender can be only F or M, and gpa is between 0 and 4. If any of the data member value is invalid, please either cin it again or set a default value.
Introduce a Department class with the following data members: vector
Introduce a constructor for Department class and the following functions:
a.void claim_major(Student*)will pass a Student pointer to this department and save the pointer in the majorsvector.
b.void demography_by_gender()will compute the percentage of male and female students. Then print out the results.
c.void demography_by_gpa()will countthe number of students of GPA < 1; 1 <= GPA< 2; 2 <= GPA < 3; and 3 <= GPA <=4. Then print out the results of four ranges.
d.void eliminate_disqualified() will eliminate all those students whose GPA are below 3.
e.void print_major() will print student name, gender and gpa within the majors vector.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started