Person.h
Code:
#ifndef PERSON_H
#define PERSON_H
#include <string>
using namespace std;
class Person {
public:
Person();
~Person();
virtual void show();
virtual void setData(string, string, string, string, int);
protected:
string FirstName, LastName, DOB, Address, Tel;
};
#endif /* PERSON_H */
Person.cpp
Code:
#include "Person.h"
Person::Person() {
}
Person::~Person() {
}
void Person::show(){
}
void Person::setData(string firstname, string lastname, string dob, string address, int tel)
{
FirstName = firstname;
LastName = lastname;
DOB = dob;
Address = address;
Tel = tel;
}
Course.h
Code:
#ifndef COURSE_H
#define COURSE_H
#include <string>
using namespace std;
class Course {
friend class Student;
public:
Course();
Course(string, string, int);
virtual ~Course();
void getCourse();
private:
string CourseName, CourseCode;
int Credit;
static float CostPerCredit;
};
#endif /* COURSE_H */
Course.cpp
Code:
#include <iostream>
#include "Course.h"
using namespace std;
Course::Course() {
}
Course::Course(string Cname, string Ccode, int Cred):CourseName(Cname),
CourseCode(Ccode), Credit(Cred)
{
}
Course::~Course() {
}
void Course::getCourse(){
cout << CourseName << "\t" << CourseCode << "\t" << Credit << "\t" << CostPerCredit << endl;
cin.get();
}
float Course::CostPerCredit = 1000.00;
Student.h
Code:
#ifndef STUDENT_H
#define STUDENT_H
#include "Person.h"
#include "Course.h"
#include <string>
using namespace std;
class Student: public Person {
public:
Student();
virtual ~Student();
void show();
void Register();
void setBio(string, string, string, string, int);
void setCourses(int);
float CalculateTotalFees();
private:
string StudentID;
float FeesPaid, FeesBalance,Inc;
Course Courses[];
};
#endif /* STUDENT_H */
Student.cpp
Code:
#include <iostream>
#include "Student.h"
using namespace std;
Student::Student() {
}
Student::~Student() {
}
void Student::Register(){
//Store registration data
string sid, fn, ln, db, ad, ph;
int i;
cout << "Enter Student ID: \t";
cin >> sid;
cout << endl << "Enter First Name: \t";
cin >> fn;
cout << endl << "Enter Surname: \t";
cin >> ln;
cout << endl << "Enter DOB: \t";
cin >> db;
cout << endl << "Enter Address: \t";
getline(cin, ad);
cout << endl << "Enter Phone #: \t";
cin >> ph;
setBio(sid, fn, ln, db, ad, ph);
cout << endl << "How many courses do you wish to do?";
cin >> i;
while(i < 3 || i > 6){
cout<<"You must enter at least 3 but no more than 6." << endl << "How many courses do you wish to do?";
cin >> i;
}
cout << "Available Courses: " << endl <<
"Code \t\t" << "Course" <<
"1 \t\t" << "Business Communication" <<
"2 \t\t" << "Business Systems" <<
"3 \t\t" << "Data Communication" << endl << endl;
if(i >= 3 && i <= 6){
setCourses(i);
}
}
void Student::show(){
//Print student data
}
void Student::setBio(string ID, string fname, string lname, string dob, string addr, int tel){
StudentID = ID;
FirstName = fname;
LastName = lname;
DOB = dob;
Address = addr;
Tel = tel;
}
void Student::setCourses(int i){
int coursetype;
for(count = 0; count <= i; count++){
cout<<"\nenter course you wish to register for: ";
cin>>coursetype;
switch(coursetype){
case 1:
Courses[1] = Course.BusComm;
}
}
}
float Student::CalculateTotalFees(){
//Calculate fees
}
main.cpp
Code:
#include <iostream>
#include "Student.h"
#include "Course.h"
using namespace std;
/*
*
*/
void header();
int main(int argc, char** argv) {
Course BusComm("Business Communication", "BSCOM03", 3),
BusSys("Business Systems", "BSSYS01", 3),
DataComm("Data Communication", "DTCM01", 3),
Network("Networking", "NETK01", 3),
Calculus("Calculus", "MATH03", 4),
Stats("Statistics", "MATH02", 3),
Algorithm("Algorithm Development", "PROG01", 3),
WebApp("Web Applications", "WEBP01", 3),
Comm1("Communication 1", "BSCOM0103", 3),
Comm2("Communication 2", "BSCOM02", 3),
VB("Visual Basic", "PROG03", 3),
DataStruct("Data Structures", "DTSTR01", 3),
Cplus("C Plus Plus", "PROG02", 3),
Econ("Micro Economics", "ECON01", 3),
DataBase("Data Management", "DBMS01", 4);
Student Ray, Dennis, Francine, Jessica, Nadine, Sandie, Neil, Chev, Jason, John;
header();
Ray.Register();
return 0;
}
void header(){
cout << "##################################################################" <<
"##################################################################" <<
"## ##" <<
"## Welcome to XLCR Course Registration System (XCRS) ##" <<
"## ##" <<
"##################################################################" <<
"##################################################################" << endl << endl;
}
Code is incomplete but its where am at so far and trying to figure out loads a stuff.