-
Notifications
You must be signed in to change notification settings - Fork 0
/
Course.cpp
48 lines (40 loc) · 970 Bytes
/
Course.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
#include <iostream>
#include <stdio.h>
#include <string>
#include <list>
#include <algorithm>
#include "Course.h"
using namespace std;
//getter for couse name
string Course::getCourseName() {
return courseName;
}
//setter for course name
void Course::setCourseName(string courseName) {
this->courseName = courseName;
}
//getter for credits
int Course::getCredits() {
return credits;
}
//setter for credits
void Course::setCredits(int credits) {
this->credits = credits;
}
//getter for gpa
double Course::getGpa() {
return gpa;
}
//setter for gpa
void Course::setGpa(double gpa) {
this->gpa = gpa;
}
//prints a general summary of the class
void Course::printCourse() {
if (gpa < 0) {
cout << courseName.c_str() << ": " << "\n\t" << "GPA: N/A" << ", Credit Hours: " << credits << endl;
}
else {
cout << courseName.c_str() << ": " << "\n\t" << "GPA: " << gpa << ", Credit Hours: " << credits << endl;
}
}