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
|
#include <iostream>
#include "Conference.h"
#include "Event.h"
#include "Person.h"
#include "Lesson.h"
#include <string>
#include <vector>
using namespace std;
int returnSelection()
{
cout << "Enter event type \n(1 for Lesson, 2 for Conference, -1 to exit):";
int selection;
cin >> selection;
return selection;
}
Person * createPerson(string title)
{
cout << title << ":\nEnter the first name: ";
string fn; cin >> fn;
cout << "Enter the last name: ";
string ln; cin >> ln;
cout << "Enter the phone number: ";
string pn; cin >> pn;
Person *personptr = new Person(fn, ln, pn);
return personptr;
}
Event * createLesson()
{
cout << "LESSON CREATION:\n";
cout << "Enter the starting data: ";
string sd; cin >> sd;
cout << "Enter the ending data: ";
string ed; cin >> ed;
cout << "Enter the location: ";
string loc; cin >> loc;
cout << "Enter the course name: ";
string cn; cin >> cn;
Lesson *lessonptr = new Lesson(sd, ed, loc, cn, *createPerson("Instructor"));
return lessonptr;
// cout << lesson.toString();
}
Event * createConference()
{
cout << "CONFERENCE CREATION:\n";
cout << "Enter the starting data: ";
string sd; cin >> sd;
cout << "Enter the ending data: ";
string ed; cin >> ed;
cout << "Enter the location: ";
string loc; cin >> loc;
cout << "Enter the Conference title: ";
string tl; cin >> tl;
cout << "Enter the of panelist: ";
int num; cin >> num;
Conference *conferenceptr = new Conference(sd, ed, loc, tl, num, createPerson("Panelist"), *createPerson("Moderator"), *createPerson("Speaker"));
return conferenceptr;
}
Event * createEvent(int selection)
{
if(selection == 1)
return createLesson();
else if (selection == 2)
return createConference();
else return 0;
}
int main() {
cout << "*******Welcome to Event Organizer!**********\n";
vector <Event*> events;
bool tf = true;
while (tf = true)
{
events.push_back(createEvent(returnSelection()));
}
for (int i=0; i<events.size(); i++)
cout << events.at(i)->toString();
return 0;
}
|