-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
39 lines (30 loc) · 1.21 KB
/
main.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
// --------------------------------------------------------------------------
// Name: Trey Dobbs
// Description: This C++ project implements all the required pieces for the
// SimBuilding class to build a building elevator simulation. Creation of the
// class constructor, the step method, and the printServiceStats() method are
// the emphasis of this project.
// --------------------------------------------------------------------------
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <string>
#include "SimBuilding.h"
int main(){
srand (time(NULL));
int numElevators = 3;
int numFloors = 60;
int arrivalRate = 25; //a rider arrives once every arrivalRate steps
int carSize = 15; //capacity of elevator cars
SimBuilding myBuilding(numElevators, numFloors, arrivalRate, carSize);
//Note: simulation will last for 24 simulated hours (2880 steps: 1 step is 30 seconds)
for(int i=0; i<2880; i++){ //2880 is 24 hours worth of steps
myBuilding.step(i + 1);
}
cout << endl << endl;
cout << "*******************" << endl;
cout << "Service Statistics:" << endl;
cout << "*******************" << endl;
myBuilding.printServiceStats();
return 0;
}