Question: 3.Observe the class Student below. (Total 50 points) class Student { private: string name; public : Student( string n, int gr []) { name =

3.Observe the class Student below. (Total 50 points) class Student { private: string name; public : Student( string n, int gr []) { name = n; for (int i=0; i<3; i++) grades[i] = gr[i]; }; int grades[ 3 ]; Answer: Write a (member) accessor function named getGrade that receives a integer parameter. Validate that the integer is between 0 and 2 (0 or 1 or 2). If the integer is valid return the corresponding grade of the grades array. If the integer is invalid return -1. For example: if the integer is equal to 1, return grades[1]. if the integer is equal to 5, return -1. (20 points) // constructor L (sa zinlog 2) zwollel ont ob of zesh ovode s ibut Thutz inabute arl Sushots en clash Insos bog

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!