time management program

I really want to improve my program
its my quiz and
it runs smoothly
(i think) :))

by using Real time same as the system time on my pc
+ addition and subtraction of time
+ calculating even with months,seconds and minutes not just by the hour
+ using 12-hour system

its a simple program that calculates the fee for staying in a hotel depending on its:
room type
membership
hours stayed

i just want to improve it :)

can anyone teach me more
i'm willing to learn

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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#include <iostream>
#include <cctype>
#include <conio.h>
#include <stdlib.h>
using namespace std;
int main()

{
char mt, rt;
int ti, to, tt, nm, m;

cout << "Welcome to Sea Crest Grand Hotel\n";
cout << "We have different rooms that you can choose\n";
cout << "(Different rates for Members and Non-Members)\n\n";
cout << "||************************************************************||\n";
cout << "||Room type                    ||Member     ||Non-Member      ||\n";
cout << "||************************************************************||\n";
cout << "||A. Suite      1st 12 Hours   ||P 3,500.00 ||P 4,000.00      ||\n";
cout << "||          Succeeding hours   ||P 500.00   ||P 600.00        ||\n";
cout << "||************************************************************||\n";
cout << "||B. De-Lux     1st 12 Hours   ||P 2,500.00 ||P 3,000.00      ||\n";
cout << "||          Succeeding hours   ||P 300.00P  ||P 400.00        ||\n";
cout << "||************************************************************||\n";
cout << "||C. Ordinary   1st 12 Hours   ||P 1,500.00 ||P 2,000.00      ||\n";
cout << "||          Succeeding hours   ||P 200.00   ||P 300.00        ||\n";
cout << "*************************************************************\n\n";
cout << "What room Type would you like? (A=suite/B=de-lux/C=ordinary)\n";
cout << "Please Type the Room of your Choice: ";
cin >> rt;
rt = static_cast<char>( toupper(rt) );
system("cls");

	
switch(rt)
{
case 'A':
cout <<"You Have Chosen THE ''Suite''\n\n";
cout << "||************************************************************||\n";
cout << "||Room type                    ||Member     ||Non-Member      ||\n";
cout << "||************************************************************||\n";
cout << "||1. SUITE      1st 12 Hours   ||P 3,500.00 ||P 4,000.00      ||\n";
cout << "||          Succeeding hours   ||P 500.00   ||P 600.00        ||\n";
cout << "||************************************************************||\n";
cout << "Are you a member or a Non-Member? (M = member /N = non-member): ";
cin >> mt;
system("cls");	
if (mt=='M' || mt=='m')
{
cout << "\nMembers fee is 1st 12 Hours = P 3,500.00/Succeeding hours = P 500.00 ";
cout << "\n(please note that we use the 24-hours military time)";
cout << "\n(1am-12pm:1-12) (1pm-12am:13-24)";
cout << "\n\nEnter the hour you accomodated the room:";					
cin >> ti;
cout << "\nEnter the hour you exited the room:";
cin >> to;
tt=to-ti;
if (tt<=12)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
cout << "\n\nTotal Bill: "; 
cout << "P 3,500.00";
}
else if (tt>=13)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
tt=((tt-12)*500)+3500;
cout << "\n\nTotal Bill:P ";
cout << tt;			            
} 						
cout<<"\nYou have entered an invalid answer";
}
else if (mt=='N' || mt=='n')
{
cout << "\nNon-Members fee is 1st 12 Hours = P 4,000.00/Succeeding hours = P 600.00 ";
cout << "\n(please note that we use the 24-hours military time)";
cout << "\n(1am-12pm:1-12) (1pm-12am:13-24)";
cout << "\n\nEnter the hour you accomodated the room:";					
cin >> ti;
cout << "\nEnter the hour you exited the room:";
cin >> to;
tt=to-ti;
if (tt<=12)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
cout << "\n\nTotal Bill: "; 
cout << "P 4,000.00";
}
else if (tt>=13)
cout << "\n\nTotal time of stay in: ";
cout << tt;
tt=((tt-12)*600)+4000;
cout << "\n\nTotal Bill:P ";
cout << tt;			            
}	
else 
cout<<"\nYou have entered an invalid answer";
break;
case 'B':
cout <<"You Have Chosen THE ''De-Lux''\n\n";
cout << "||************************************************************||\n";
cout << "||Room type                    ||Member     ||Non-Member      ||\n";
cout << "||************************************************************||\n";
cout << "||1. SUITE      1st 12 Hours   ||P 2,500.00 ||P 3,000.00      ||\n";
cout << "||          Succeeding hours   ||P 300.00   ||P 400.00        ||\n";
cout << "||************************************************************||\n";
cout << "Are you a member or a Non-Member? (M = member /N = non-member): ";
cin >> mt;
system("cls");	
if (mt=='M' || mt=='m')
{
cout << "\nMembers fee is 1st 12 Hours = P 2,500.00/Succeeding hours = P 300.00 ";
cout << "\n(please note that we use the 24-hours military time)";
cout << "\n(1am-12pm:1-12) (1pm-12am:13-24)";
cout << "\n\nEnter the hour you accomodated the room:";					
cin >> ti;
cout << "\nEnter the hour you exited the room:";
cin >> to;
tt=to-ti;
if (tt<=12)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
cout << "\n\nTotal Bill: "; 
cout << "P 2,500.00";
}
else if (tt>=13)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
tt=((tt-12)*300)+2500;
cout << "\n\nTotal Bill:P ";
cout << tt;			            
}
else 
cout<<"\nYou have entered an invalid answer";
}
else if (mt=='N' || mt=='n')
{
cout << "\nNon-Members fee is 1st 12 Hours = P 3,000.00/Succeeding hours = P 400.00 ";
cout << "\n(please note that we use the 24-hours military time)";
cout << "\n(1am-12pm:1-12) (1pm-12am:13-24)";
cout << "\n\nEnter the hour you accomodated the room:";					
cin >> ti;
cout << "\nEnter the hour you exited the room:";
cin >> to;
tt=to-ti;
if (tt<=12)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
cout << "\n\nTotal Bill: "; 
cout << "P 3,000.00";
}
else if (tt>=13)
cout << "\n\nTotal time of stay in: ";
cout << tt;
tt=((tt-12)*400)+3000;
cout << "\n\nTotal Bill:P ";
cout << tt;			            
}
else 
cout<<"\nYou have entered an invalid answer";
break;
case 'C':
cout <<"You Have Chosen THE ''Suite''\n\n";
cout << "||************************************************************||\n";
cout << "||Room type                    ||Member     ||Non-Member      ||\n";
cout << "||************************************************************||\n";
cout << "||C. Ordinary   1st 12 Hours   ||P 1,500.00 ||P 2,000.00      ||\n";
cout << "||          Succeeding hours   ||P 200.00   ||P 300.00        ||\n";
cout << "||************************************************************||\n";
cout << "Are you a member or a Non-Member? (M = member /N = non-member): ";
cin >> mt;
system("cls");	
if (mt=='M' || mt=='m')
{
cout << "\nMembers fee is 1st 12 Hours = P 3,500.00/Succeeding hours = P 500.00 ";
cout << "\n(please note that we use the 24-hours military time)";
cout << "\n(1am-12pm:1-12) (1pm-12am:13-24)";
cout << "\n\nEnter the hour you accomodated the room:";					
cin >> ti;
cout << "\nEnter the hour you exited the room:";
cin >> to;
tt=to-ti;
if (tt<=12)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
cout << "\nTotal Bill: "; 
cout << "P 1,500.00";
}
else if (tt>=13)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
tt=((tt-12)*200)+1500;
cout << "\nTotal Bill:P ";
cout << tt;			            
}
else 
cout<<"\nYou have entered an invalid answer";
}
else if (mt=='N' || mt=='n')
{
cout << "\nNon-Members fee is 1st 12 Hours = P 2,000.00/Succeeding hours = P 300.00 ";
cout << "\n(please note that we use the 24-hours military time)";
cout << "\n(1am-12pm:1-12) (1pm-12am:13-24)";
cout << "\n\nEnter the hour you accomodated the room:";					
cin >> ti;
cout << "\nEnter the hour you exited the room:";
cin >> to;
tt=to-ti;
if (tt<=12)
{
cout << "\n\nTotal time of stay in: ";
cout << tt;
cout << "\nTotal Bill: "; 
cout << "P 2,000.00";
}
else if (tt>=13)
cout << "\n\nTotal time of stay in: ";
cout << tt;
tt=((tt-12)*300)+2000;
cout << "\nTotal Bill:P ";
cout << tt;			            
}
else 
cout<<"\nYou have entered an invalid answer";
break;
}
system("pause>0");
}
Last edited on
Topic archived. No new replies allowed.