Question: This lab has been designed for you to practice the implementation and testing of member functions of a Student class. The 0 4 _ student

This lab has been designed for you to practice the implementation and testing of member functions of a Student class. The 04_student project contains the following Student class in the Student.h file.
Here are more details about the private data members:
name_ is to store the name for a student.
pronouns_ is to store the gender pronouns for the student in the subjective/objective/possessive pronouns form. For example, she/her/her,he/him/his,they/them/their...
labs_ is to store the lab grades for a student.
You are asked to implement the member functions of the Student class in the Student.cpp file and test them in the main.cpp file.
Here are more details about the expected behavior of the public member functions:
Student::Student();
The default constructor is to set the name_ and pronouns_ of a new Student object to Unknown and they/them/their, respectively. In addition, the constructor shall initialize the lab grades to 0 for all ten labs.
Student::Student(const string& name, const string& pronouns);
This constructor takes a string parameter name that represents a student name and a string parameter pronouns that represents the students preferred gender pronouns in the
subjective/objective/possessive format. The constructor is to create a new Student object using the name and pronouns provided. In addition, the constructor shall initialize the lab grades to 0 for all ten labs.
string Student::to_string() const;
This accessor function is to return a string that contains a summary of the invoking Student object. For example, given the following code segment:
Your program shall generate the following output. Note the returned string from the to_string function includes the following about the invoking Student object: name, subjective and possessive pronoun, the ten lab grades in two rows, and total earned points for the labs.
void Student::update_lab(unsigned pos, unsigned grade);
This mutator function is to update a specific labs grade for the invoking Student object. It takes two unsigned parameters pos and grade that represent the index of the specific lab to update and the new grade for that lab, respectively.
For example, given the following code segment:
Your program shall generate the following output:
If an invalid pos and/or invalid grade are provided for the function, no change shall be made to the labs_ array. Instead, the function shall display a message explaining why the update is not successful. A lab grade should be an integer from 0 to 10 inclusive.
void Student::update_labs(const string& grades);
This mutator function is to update all the elements of the labs_ array for the invoking Student object. It takes a string grades that contains ten integers separated by commas. You may assume that each integer represents a lab grade from 0 to 10. The function parses the string grades using string stream and assigns the first integer to the first lab grade, the second integer to the second lab grade and so on. For example, given the following call to update_labs and to_string:
Your program shall generate the following output:
void Student::update_labs(const unsigned grades[]);
This mutator function is to update all the elements of the labs_ array for the invoking Student object. It takes an array of unsigned integers grades as a parameter and copies the first ten elements of grades to the labs_ array. You may assume the array passed to this function contains only grades from 0 to 10.
In the main.cpp, create at least two Students objects using different constructors, then test the different mutator and accessor methods. You are encouraged to call the to_string method after every function call to help test these functionsThe student's name is Unknown; their lab grades are:
Overall, they earned 0 out of 100 points.
 This lab has been designed for you to practice the implementation

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!