Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (48 loc) · 1.55 KB
/
Copy pathmain.cpp
File metadata and controls
59 lines (48 loc) · 1.55 KB
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
#include <iostream>
#include "entities/vehicle.hpp"
#include "entities/user.hpp"
#include "./services/bookingService.hpp"
using namespace std;
int main() {
string userId;
string name;
string aadharCard;
cout << "Enter User ID: ";
cin >> userId;
cout << "Enter Name: ";
cin >> name;
cout << "Enter Aadhar Card Number: ";
cin >> aadharCard;
cout << "Enter the option: " << endl;
cout << "Enter 1 to book the train" << endl;
int option;
cin >> option;
// signup login user using userid --> user.json
// fetch train using train name --> train.json
// booking --> fetch train using trainId, fetch seats, store user there, booking.json
switch(option) {
case 1: {
string trainId, trainName, source, destination;
cout << "Enter Train ID: ";
cin >> trainId;
cout << "Enter Train Name: ";
cin >> trainName;
cout << "Enter Source Station: ";
cin >> source;
cout << "Enter Destination Station: ";
cin >> destination;
User user;
user.userId = userId;
user.name = name;
user.aadharCard = aadharCard;
BookingService<Vehicle> bookingService;
bookingService.book(trainId, user, trainName, source, destination);
cout << "Train booked successfully!" << endl;
break;
}
default:
cout << "Invalid option" << endl;
break;
}
return 0;
}