-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructor.cpp
81 lines (66 loc) · 3.02 KB
/
instructor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/***************************************************************************************************
** Author: Michael Johnson
** Date: 7/19/2017
** Description: Definitions of Instructor class functions
***************************************************************************************************/
#include "Instructor.h"
/*******************************************************************************************************
** Instructor Default Constructor
** Constructs the object with empty variables
*******************************************************************************************************/
Instructor::Instructor() : People()
{
instructorName = "";
instructorAge = 0;
instructorScore = 0.0;
}
/*******************************************************************************************************
** Instructor Constructor
** Constructs the object with user input for each variable
*******************************************************************************************************/
Instructor::Instructor(string n, int a, double s) : People(n, a, s)
{
instructorName = n;
instructorAge = a;
instructorScore = s;
}
/*******************************************************************************************************
** Instructor destructor
** Destructs the object
*******************************************************************************************************/
Instructor::~Instructor()
{
}
/*******************************************************************************************************
** getName function
** returns the name of instructor variable
*******************************************************************************************************/
string Instructor::getName()
{
return this->instructorName;
}
/*******************************************************************************************************
** getAge function
** returns the age of instructor variable
*******************************************************************************************************/
int Instructor::getAge()
{
return this->instructorAge;
}
/*******************************************************************************************************
** getScore function
** returns the score of instructor variable
*******************************************************************************************************/
double Instructor::getScore()
{
return this->instructorScore;
}
/*******************************************************************************************************
** do_work function
** creates a random number between 1 and the user input and stores it
*******************************************************************************************************/
void Instructor::do_work(int x)
{
hoursWorked = rand() % x + 1;
cout << getName() << " graded papers for " << hoursWorked << " hours." << endl;
}