Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <string>
- #include <iostream>
- using namespace std;
- class personInLine {
- public:
- int waitTime;
- };
- class sim {
- public:
- queue<personInLine> persons;
- int timeFromZero = 0;
- int targetTime = 120;
- int numberOfPeopleServed = 0;
- int numberOfPeopleInline = 0;
- int nextArrivalTime = 0;
- sim() {
- while (timeFromZero < targetTime) {
- minute();
- //add person to line
- if (timeFromZero == nextArrivalTime) {
- nextArrival(); ;
- }
- }
- }
- void minute() {
- timeFromZero++;
- }
- void nextArrival(personInLine input) {
- personInLine newPerson;
- persons.push(newPerson);
- }
- void addPersonToLine() {
- numberOfPeopleInline++;
- }
- void personLeftLine() {
- numberOfPeopleServed++;
- }
- void nextCustomer() {
- cout << "Next Customer" << endl;
- cout << "Total Time To Server: " << endl;
- cout << "Scheduling next customer " << endl;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment