Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Design a class called Student. Separate the declaration and methods definition file. The class should store the following student information: name: student's name, type is
Design a class called Student. Separate the declaration and methods definition file. The class
should store the following student information:
name: student's name, type is string
id: student ID
type is string
numTests: number of tests, type is int
scores: a pointer to an array of test scores, type is double
Define the following member functions:
Constructors:
Student
int
: Parameterized constructor with number of tests as the parameter.
Student
string
string int
: Parameterized constructor with student name, student id
and number of tests as parameters.
Destructor
~Student
Mutator functions:
setName
string name
setId
string id
setScore
int testNum, double score
Accessor functions:
string getName
: get student name
string getId
: get student ID
double getScore
int n
: get score of test n
int getNumTests
: get number of tests
Use Labcpp to test your class.
#include
#include "Student.h
using namespace std;
int main
Student sJohn Doe", s;
ssetScore;
ssetScore;
ssetScore;
ssetNameBuzz;
ssetId;
ssetScore;
ssetScore;
get students' first test score
cout "Name: sgetName Score: sgetScore endl;
cout "Name: sgetName Score: sgetScore endl;
print students info
cout
Studdent ;
sprintStudentInfo;
cout Studdent ;
sprintStudentInfo;
ssetNameJoseph;
ssetScore;
cout
Studdent ;
sprintStudentInfo;
return ;
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