1 /* Roy Keene 2 CS 2314 3 Section 04 4 Lab 02 5 27 Aug 02 6 student.cc 7 */ 8 9 10 #include <string> 11 #include <iostream> 12 13 using namespace std; 14 #include "student.h" 15 16 Student::Student(string name, string country) { 17 Name=name; 18 Country=country; 19 return; 20 } 21 22 Student::Student(string name) { 23 Name=name; 24 return; 25 } 26 27 Student::Student(void) { 28 return; 29 } 30 31 Student::~Student(void) { 32 return; 33 } 34 35 string Student::getName(void) { 36 return(Name); 37 } 38 39 string Student::getCountry(void) { 40 return(Country); 41 } 42 43 void Student::setName(string name) { 44 Name=name; 45 } 46 47 void Student::setCountry(string country) { 48 Country=country; 49 } 50 51 void Student::Display(void) { 52 cout << "Student Name: " << getName() << "\n" << "Student Country: " << getCountry() << "\n"; 53 } 54 55 CreditStudent::CreditStudent(int credits) { 56 StudentCredits=credits; 57 return; 58 } 59 60 CreditStudent::CreditStudent(void) { 61 return; 62 } 63 64 CreditStudent::~CreditStudent(void) { 65 return; 66 } 67 68 void CreditStudent::setNumCredits(int credits) { 69 StudentCredits=credits; 70 } 71 72 int CreditStudent::getNumCredits(void) { 73 return(StudentCredits); 74 } 75 76 double CreditStudent::computeTuition(void) { 77 if (StudentCredits>9) { 78 return(StudentCredits*350.0); 79 } else { 80 return(StudentCredits*500.0); 81 } 82 } 83 84 void CreditStudent::Display(void) { 85 cout << "Credit Student:" << "\n Student Name: " << getName() << "\n Student Country: " << getCountry() << "\n Credits: " << StudentCredits << "\n Tuition: $" << computeTuition() << "\n"; 86 } 87 88 ExchangeStudent::ExchangeStudent(double courses) { 89 StudentCourses=courses; 90 return; 91 } 92 93 ExchangeStudent::ExchangeStudent(void) { 94 return; 95 } 96 97 ExchangeStudent::~ExchangeStudent(void) { 98 return; 99 } 100 101 void ExchangeStudent::setNumCourses(double courses) { 102 StudentCourses=courses; 103 } 104 105 double ExchangeStudent::getNumCourses(void) { 106 return(StudentCourses); 107 } 108 109 double ExchangeStudent::computeTuition(void) { 110 if (StudentCourses>2) { 111 return(StudentCourses*750.0); 112 } else { 113 return(StudentCourses*800.0); 114 } 115 } 116 117 void ExchangeStudent::Display(void) { 118 cout << "Exchange Student:" << "\n Student Name: " << getName() << "\n Student Country: " << getCountry() << "\n Number of courses: " << StudentCourses << "\n Tuition: $" << computeTuition() << "\n"; 119 } |