2019-05-28 16:46:55 +00:00
|
|
|
#include "headers/Park_spot.h"
|
|
|
|
#include <iostream>
|
|
|
|
#include <thread> // to make pausing work, not sure if i need chrono, or this, or both
|
|
|
|
#include <vector>
|
|
|
|
|
2019-06-20 11:08:02 +00:00
|
|
|
|
2019-06-25 00:09:33 +00:00
|
|
|
|
2019-06-20 11:08:02 +00:00
|
|
|
/*
|
|
|
|
Code strucure like this:
|
2019-06-20 11:11:33 +00:00
|
|
|
class declarations zijn in /headers/class_naam.h, en definitions van de member functs in /class_naam.cpp
|
2019-06-20 11:08:02 +00:00
|
|
|
elke klas in zn eigen file omdat ik incomplete class declarations wilt tegengaan, omdat ik ze niet goed begrijp.
|
|
|
|
En header/source split om multiple definition errors tegen te gaan.
|
|
|
|
|
|
|
|
Park_spot representeert een parkeermeter bij elke parkeer spot.
|
|
|
|
Een customer is een customer.
|
|
|
|
Park time is een object die reffereert naar parkspot en customer, basically een record die zegt dat
|
|
|
|
een customer voor x tijd geparkeert heeft bij spot x, enz.
|
|
|
|
|
|
|
|
De client clockt in en uit bij een spot.
|
|
|
|
*/
|
|
|
|
|
2019-05-28 16:46:55 +00:00
|
|
|
void Wait(int sec)
|
2019-06-20 11:08:02 +00:00
|
|
|
/*
|
|
|
|
a wait function where 1 sec represents 1 hour irl.
|
|
|
|
*/
|
2019-05-28 16:46:55 +00:00
|
|
|
{
|
|
|
|
std::this_thread::sleep_for(seconds { sec });
|
|
|
|
}
|
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
|
2019-06-20 11:08:02 +00:00
|
|
|
|
2019-05-28 16:46:55 +00:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
std::vector<Park_spot> spots {
|
|
|
|
1, 2, 3, 4, 5
|
|
|
|
};
|
|
|
|
std::vector<Customer> customers {
|
2019-06-25 00:09:33 +00:00
|
|
|
{ 1, "Sagar Ram", Verhicle_type::small },
|
|
|
|
{ 2, "Shaq", Verhicle_type::medium },
|
|
|
|
{ 3, "Josh", Verhicle_type::large },
|
|
|
|
{ 4, "Stefano", Verhicle_type::small }
|
2019-05-28 16:46:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
spots[1].clock(&customers[3]); // stefano parks at spot 2
|
|
|
|
Wait(2);
|
|
|
|
spots[3].clock(&customers[2]); // josh parks at spot 4
|
|
|
|
Wait(1);
|
|
|
|
spots[1].clock(&customers[3]); // stefano clocks out of spot 1
|
|
|
|
Wait(5);
|
|
|
|
spots[1].clock(&customers[1]); // shaq clocks in at spot 1
|
|
|
|
Wait(6);
|
|
|
|
spots[2].clock(&customers[0]); // sagar clocks in at spot 3. what the fuck is he doing here?
|
|
|
|
Wait(2);
|
|
|
|
spots[2].clock(&customers[0]); // sagar clocks out from spot 2
|
|
|
|
Wait(3);
|
|
|
|
spots[3].clock(&customers[2]); // josh clocks out from spot 4
|
|
|
|
spots[1].clock(&customers[1]); // shaq clocks out at spot 1
|
|
|
|
|
|
|
|
spots[2].clock(&customers[1]); // shaq clocks out at spot 3
|
|
|
|
Wait(4);
|
|
|
|
spots[2].clock(&customers[1]); // shaq clocks out at spot 2
|
|
|
|
|
|
|
|
/*
|
|
|
|
so:
|
|
|
|
stefan parked for 3 secs
|
|
|
|
josh parked for 17 secs
|
|
|
|
shaq parked 2 times, once for 4 and another for 11 secs
|
|
|
|
sagar parked for 2 secs
|
|
|
|
*/
|
|
|
|
customers[0].gen_monthly();
|
|
|
|
customers[1].gen_monthly();
|
|
|
|
customers[2].gen_monthly();
|
|
|
|
customers[3].gen_monthly();
|
|
|
|
}
|