Skip to content

Commit

Permalink
Added new Class to help Manage the Schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
sagidayan committed Apr 17, 2014
1 parent 63c1562 commit 9930288
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
29 changes: 29 additions & 0 deletions SchoolDay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "SchoolDay.h"

SchoolDay::SchoolDay()
{
cout << "Building Day" << endl;
}

SchoolDay::~SchoolDay()
{
cout << "Killing Day" << endl;
}

void SchoolDay::addCourse(string& name, int start_time, int hoursLong, string& room)
{
CourseTime c = {name, start_time, start_time+hoursLong, room};
schedule.push_back(&c);
schedule.sort();
}

void SchoolDay::printDay()
{
for(CourseTime* c : schedule)
{
cout << "-----------" << endl;
cout << c->name << endl;
cout << c->startTime << "---" << c->endTime << endl;
cout << c->room << endl;
}
}
33 changes: 33 additions & 0 deletions SchoolDay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef S_DAY_H
#define S_DAY_H

#include <list>
#include <string>
#include <iostream>


using namespace std;

typedef struct CourseTime{
string name;
int startTime;
int endTime;
string room;
}CourseTime;

class SchoolDay{

public:
SchoolDay();
~SchoolDay();
void addCourse(string& name, int start_time, int hoursLong, string& room);
void printDay();
private:
list<CourseTime*> schedule;

};




#endif

0 comments on commit 9930288

Please sign in to comment.