-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.h
119 lines (90 loc) · 4.15 KB
/
Student.h
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
"1. Create the base class Student in the files student.h and student.cpp, which includes each of the following variables :
• student ID
• first name
• last name
• email address
• age
• array of number of days to complete each course
• degree types
Note : Degree type should be populated in subclasses only.
2. Create each of the following functions in the Student class :
a.an accessor(i.e., getter) for each instance variable from part D1
b.a mutator(i.e., setter) for each instance variable from part D1
Note : All access and changes to the instance variables of the Student class should be done through the accessor and mutator functions.
c.constructor using all of the input parameters provided in the table
d. virtual print() to print specific student data
e.destructor
f. virtual getDegreeProgram()
Note: Leave the implementation of the getDegreeProgram() function empty."
*/
#pragma once
#include <string>
#include <array>
#include "Degree.h"
typedef unsigned int AGE;
typedef unsigned int DAYS;
class Student {
public:
//"constructor using all of the input parameters provided in the table"
//i.e. including DegreeType
//"Note: Degree type should be populated in subclasses only."
//Passing daysInCourse as an array, even though project specs call for each
//day to be passed individually, because it would make it easier to change
//the number of courses allowed, and I wanted to work with passing an
//array object.
//I am cognizant that this would require approval in a team environment.
Student(std::string sId, std::string firstName, std::string lastName,
std::string email, AGE age, std::array<DAYS, 3> daysInCourse,
const Degree degreeType);
Student(const Student& obj);
~Student();
const std::string GetSId();
const std::string GetFirstName();
const std::string GetLastName();
const std::string GetEmail();
const AGE GetAge();
const DAYS GetDaysInCourse(const int course);
//"2. Create each of the following functions in the Student class :
//"a.an accessor(i.e., getter) for *each* instance variable from part D1
//"a mutator(i.e., setter) for *each* instance variable from part D1"
//(i.e. even DegreeType)
//"Note: Leave the implementation of the getDegreeProgram() function empty."
//Making base abstract (via pure virtual SetDegreeType()) to fulfill this,
//but leaving GetDegreeType() not pure so that it can be inherited.
//One might consider making the base class instantiable to cover
//undecided students, if your school allows that, but creating an
//undecided derived class would work just as well and maintain an
//abstract base class.
const virtual Degree GetDegreeType() = 0;
std::string GetDegreeStr();
void SetSId(const std::string& sId);
void SetFirstName(const std::string& firstName);
void SetLastName(const std::string& lastName);
void SetEmail(const std::string& email);
void SetAge(const AGE age);
//Using array object here to try it out, even though a simple array would
//allow you to pass different lengths in case policy changed that allowed students to have more than 3 courses.
void SetDaysInCourse(const std::array<DAYS, 3> daysInCourse);
//"a mutator(i.e., setter) for each instance variable" (even DegreeType)
//"Note: Degree type should be populated in subclasses only."
void SetDegreeType(const Degree degreeType);
void SetAll(const std::string& sId, const std::string& firstName,
const std::string& lastName, const std::string& email, const AGE age,
const std::array<DAYS, 3> daysInCourse, const Degree degreeType);
virtual void Print();
private:
//PK, required. No robust input validation included in this program, though.
std::string SId;
std::string FirstName;
std::string LastName;
std::string Email;
AGE Age;
//I'm assuming a fixed number of courses for simplicity's sake,
//and because stored data implies this fixed number.
//However, we could set a higher max number of courses and accept data
//with varying structures.
std::array<DAYS, 3> DaysInCourse;
protected:
Degree DegreeType; //"populated in subclasses only"
};