-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (28 loc) · 695 Bytes
/
Copy pathmain.cpp
File metadata and controls
33 lines (28 loc) · 695 Bytes
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
#include <iostream>
#include "Garage.h"
#include "Car.h"
int main() {
try
{
Garage garage(2);
Car car1(10, 10);
Car car2(20, 10);
std::string ticket1 = garage.park(car1);
std::string ticket2 = garage.park(car2);
garage.takeVehicleOut(ticket1);
garage.takeVehicleOut(ticket2);
}
catch(const ParkingFullError& e) {
std::cerr << e.what() << std::endl;
std::cerr << "Please increase parking capacity" << std::endl;
}
catch(const ParkingIdNotFound& e) {
std::cerr << e.what() << std::endl;
std::cerr << "Parking id not found" << std::endl;
}
catch(const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
return 0;
}