-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetroproject.cpp
132 lines (116 loc) · 3.05 KB
/
metroproject.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#pragma once
#include <iostream>
#include<unordered_map>
#include"MetroSystem.h"
#include"User.h"
#include"SubscriptionPlan.h"
#include"Subscription.h"
using namespace std;
int main()
{
//it must put in the metro system class
//cout << "elhamdoulelallah \n";
MetroSystem metro;
SubscriptionPlan plan;
// this for testing the subscriptions plans for the admin and it is done
while (true)
{
cout << "enter 1 to display \n";
cout << "enter 2 to add \n";
cout << "enter 3 to edit \n";
cout << "enter 4 to delete \n";
cout << "enter 5 ti exist \n";
int num;
cin >> num;
if (num == 1)
{
plan.display_All_Plans();
}
else if (num == 2)
{
SubscriptionPlan newone;
newone.add_Subscription_Plan();
}
else if (num == 4)
{
plan.delete_Subscription_Plan();
}
else if (num == 3)
plan.edit_Subscription_Plan();
else
break;
}
//now testing the part of the subscription for the user
User user;
while (true)
{
// now in subscription and renew and upgrade there is a check it must be done first that there is no any subscriptions he subscribe on it now
cout << "enter 1 to display details \n";
cout << "enter 2 to subscribe \n";
cout << "enter 3 to renew \n";
cout << "enter 4 to upgrade \n";
cout << "enter 5 to see the history \n";
cout << "enter 6 to stop your current subscription \n";
int num;
cin >> num;
if (num == 1)
{
if (user.current.isActive())//if he have one active it will be in the current so he can view else no
user.current.view_Subscription_details();
else
cout << "there is no any active subscription \n";
//plan.display_All_Plans();
}
else if (num == 2)
{
if (user.current.isActive())//if is account still active
{
cout << "you an not subscribe on any other subscribtions until the current one finish. \n";
}
else
{
Subscription temp;
temp.purchase_Subscription();
user.history.push_back(user.current);
user.setCurrent(temp);
}
}
else if (num == 3)
{
// in the renew plan we must first chech if its current subscription is active or not
if (user.current.isActive())
cout << "you can not renew until your currnet one finished. \n";
else
{
user.history.push_back(user.current);//push the old
user.current.renew_Subscription();
}
}
else if (num == 4)
{
// in the upgrade plan we must first chech if its current subscription is active or not
if (user.current.isActive())
cout << "you can not upgrade until your currnet one finished. \n";
else
{
Subscription copy = user.current;
user.history.push_back(user.current);//push the old
user.current.upgrade_Subscription(copy);
}
}
else if (num == 5)
{
for (auto it : user.history)// it must display all the details for every subscription in this history
{
cout << it.getAvailableTrips();
}
}
else if(num==6) {
//plan.edit_Subscription_Plan();
}
else
{
}
}
return 0;
}