Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. //This is my heading of a rickshaw advertising "ODUSports"
  11. cout << "******************************************************************" << endl;
  12. cout << "********************************____________________**************" << endl;
  13. cout << "*******************************/ |///////////)*************" << endl;
  14. cout << "*****************************/ |//ODUSPORTS/)************" << endl;
  15. cout << "*********()()()************/ |/////////////)***********" << endl;
  16. cout << "***_____()()()()_________/______________|//////////////)__********" << endl;
  17. cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
  18. cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
  19. cout << "****(/////ODUSPORTS/////|///ODUSPORTS///////ODUSPORTS//_|_|>~~~~~*" << endl;
  20. cout << "*****(//////////////////|/////////////////////////////)***********" << endl;
  21. cout << "******(__()()()()_______|___________/ ()()()()()()()_)************" << endl;
  22. cout << "********() ()*******************() () ()*************" << endl;
  23. cout << "********() () ()*******************() () () () ()*************" << endl;
  24. cout << "********() ()*******************() () ()*************" << endl;
  25. cout << "*********()()()()*********************()()()()()()()**************" << endl;
  26. cout << "******************************************************************" << endl;
  27.  
  28. //* Steps to my program
  29.  
  30. //(1) Declare some variables to work with
  31. char fare;
  32. char choice='Y';
  33. int hrIn, minIn, hrOut, minOut;
  34. int hours,
  35. minutes,
  36. total_minutes,
  37. additionalTime;
  38. double cost1,
  39. cost2,
  40. cost3,
  41. cost4;
  42.  
  43. //(2) Declare some constant variables to work with
  44. const double chargeS = 7.00;
  45. const double chargeC = 10.50;
  46. const double chargeG = 16.00;
  47.  
  48. while(choice=='Y'||choice=='y'){
  49.  
  50. //(3) This clears the screen and starts over
  51. system("CLS");
  52.  
  53. cout << "******************************************************************" << endl;
  54. cout << "********************************____________________**************" << endl;
  55. cout << "*******************************/ |///////////)*************" << endl;
  56. cout << "*****************************/ |//ODUSPORTS/)************" << endl;
  57. cout << "*********()()()************/ |/////////////)***********" << endl;
  58. cout << "***_____()()()()_________/______________|//////////////)__********" << endl;
  59. cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
  60. cout << "***(////////////////////|///////////////|///////////////|_|>~~~~~*" << endl;
  61. cout << "****(/////ODUSPORTS/////|///ODUSPORTS///////ODUSPORTS//_|_|>~~~~~*" << endl;
  62. cout << "*****(//////////////////|/////////////////////////////)***********" << endl;
  63. cout << "******(__()()()()_______|___________/ ()()()()()()()_)************" << endl;
  64. cout << "********() ()*******************() () ()*************" << endl;
  65. cout << "********() () ()*******************() () () () ()*************" << endl;
  66. cout << "********() ()*******************() () ()*************" << endl;
  67. cout << "*********()()()()*********************()()()()()()()**************" << endl;
  68. cout << "******************************************************************" << endl;
  69.  
  70. //(4) Output read info and user message
  71. cout << "\nThis program will calculate a single, couple, or group "
  72. << "\nfare amount which is then owed by the customer for the trip.\n"
  73. << "\nTo calculate a single fare amount, input S (or s)"
  74. << "\nTo calculate a couple fare amount, input C (or c)"
  75. << "\nTo calculate a group fare amount, input G (or g)"
  76. << " \n\nInput S, C, or G: ";
  77. cin >> fare;
  78.  
  79. // end of description
  80.  
  81. //--------------------------------------------------------------------------------
  82.  
  83. //(5) This begins the S if and else statements
  84.  
  85. if(fare=='S'||fare=='s'){
  86.  
  87. cout << "\nWhat hour did the single customer depart? ";
  88. cin >> hrOut;
  89. cout << "\nWhat minute did the single customer depart? ";
  90. cin >> minOut;
  91. cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
  92. cout << "\nWhat hour did the single customer arrive? ";
  93. cin >> hrIn;
  94. cout << "\nWhat minute did the single customer arrive? ";
  95. cin >> minIn;
  96. cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
  97. cout << "A rickshaw departed at " << hrOut << ":" << minOut
  98. << " and arrived at " << hrIn << ":" << minIn << " with a single customer.\n" << endl;
  99.  
  100. if(hrIn < hrOut && minIn <= minOut){
  101.  
  102. hours = (hrIn - hrOut) + 23;
  103. cout << "The single customer arrived in " << hours << " hour(s)";
  104. minutes = (minIn - minOut) + 60;
  105. cout << " and " << minutes << " minute(s)";
  106. total_minutes = (hours * 60) + minutes;
  107. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  108.  
  109. }
  110. else if(hrOut < hrIn && minOut <= minIn){
  111.  
  112. hours = (hrIn - hrOut);
  113. cout << "The single customer arrived in " << hours << " hour(s)";
  114. minutes = (minIn - minOut);
  115. cout << " and " << minutes << " minute(s)";
  116. total_minutes = (hours * 60) + minutes;
  117. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  118. }
  119.  
  120. //-----------------------------------------------------//(6) Different if and else but apart of S if
  121. else if(hrIn < hrOut && minOut <= minIn){
  122.  
  123. hours = (hrIn - hrOut) + 24;
  124. cout << "The single customer arrived in " << hours << " hour(s)";
  125. minutes = (minIn - minOut);
  126. cout << " and " << minutes << " minute(s)";
  127. total_minutes = (hours * 60) + minutes;
  128. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  129. }
  130. else if(hrOut < hrIn && minIn <= minOut){
  131.  
  132. hours = (hrIn - hrOut) - 1;
  133. cout << "The single customer arrived in " << hours << " hour(s)";
  134. minutes = (minIn - minOut) + 60;
  135. cout << " and " << minutes << " minute(s)";
  136. total_minutes = (hours * 60) + minutes;
  137. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  138. }
  139.  
  140. //-----------------------------------------------------//(7) Different if and else but apart of S if
  141. else if(hrIn <= hrOut && minOut <= minIn){
  142.  
  143. hours = (hrIn - hrOut);
  144. cout << "The single customer arrived in " << hours << " hour(s)";
  145. minutes = (minIn - minOut);
  146. cout << " and " << minutes << " minute(s)";
  147. total_minutes = (hours * 60) + minutes;
  148. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  149. }
  150.  
  151. if(total_minutes <=30){
  152.  
  153. cout << fixed << showpoint << setprecision(2);
  154.  
  155. cout << "The single customer will pay $" << chargeS << " dollars.\n" << endl;
  156.  
  157. }
  158. else{
  159.  
  160. additionalTime = total_minutes - 30;
  161. cout << "The single customer will be charged for " << additionalTime << " extra minute(s).\n" << endl;
  162.  
  163. cost1 = chargeS + (((total_minutes) - 30) * 1.50);
  164. cout << fixed << showpoint << setprecision(2);
  165. cout << "The single customer will pay $" << cost1 << " dollars.\n" << endl;
  166. }
  167. }
  168.  
  169. //(8) End of S if
  170.  
  171. //--------------------------------------------------------------------------------
  172.  
  173. //(9) This begins the C if and else statements
  174.  
  175. else if(fare=='C'||fare=='c'){
  176.  
  177. cout << "\nWhat hour did the couple depart? ";
  178. cin >> hrOut;
  179. cout << "\nWhat minute did the couple depart? ";
  180. cin >> minOut;
  181. cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
  182. cout << "\nWhat hour did the couple arrive? ";
  183. cin >> hrIn;
  184. cout << "\nWhat minute did the couple arrive? ";
  185. cin >> minIn;
  186. cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
  187. cout << "A rickshaw departed at " << hrOut << ":" << minOut
  188. << " and arrived at " << hrIn << ":" << minIn << " with a couple of customers.\n" << endl;
  189.  
  190. if(hrIn < hrOut && minIn <= minOut){
  191.  
  192. hours = (hrIn - hrOut) + 23;
  193. cout << "The couple arrived in " << hours << " hour(s)";
  194. minutes = (minIn - minOut) + 60;
  195. cout << " and " << minutes << " minute(s)";
  196. total_minutes = (hours * 60) + minutes;
  197. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  198. }
  199. else if(hrOut < hrIn && minOut <= minIn){
  200.  
  201. hours = (hrIn - hrOut);
  202. cout << "The couple arrived in " << hours << " hour(s)";
  203. minutes = (minIn - minOut);
  204. cout << " and " << minutes << " minute(s)";
  205. total_minutes = (hours * 60) + minutes;
  206. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  207. }
  208.  
  209. //-----------------------------------------------------//(10) Different if and else but apart of C if
  210. else if(hrIn < hrOut && minOut <= minIn){
  211.  
  212. hours = (hrIn - hrOut) + 24;
  213. cout << "The couple arrived in " << hours << " hour(s)";
  214. minutes = (minIn - minOut);
  215. cout << " and " << minutes << " minute(s)";
  216. total_minutes = (hours * 60) + minutes;
  217. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  218. }
  219. else if(hrOut < hrIn && minIn <= minOut){
  220.  
  221. hours = (hrIn - hrOut) - 1;
  222. cout << "The couple arrived in " << hours << " hour(s)";
  223. minutes = (minIn - minOut) + 60;
  224. cout << " and " << minutes << " minute(s)";
  225. total_minutes = (hours * 60) + minutes;
  226. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  227. }
  228.  
  229. //-----------------------------------------------------//(11) Different if and else but apart of C if
  230. else if(hrIn <= hrOut && minOut <= minIn){
  231.  
  232. hours = (hrIn - hrOut);
  233. cout << "The couple arrived in " << hours << " hour(s)";
  234. minutes = (minIn - minOut);
  235. cout << " and " << minutes << " minute(s)";
  236. total_minutes = (hours * 60) + minutes;
  237. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  238. }
  239.  
  240. if(total_minutes <=20){
  241.  
  242.  
  243. cout << fixed << showpoint << setprecision(2);
  244. cout << "The couple will pay $" << chargeC << " dollars.\n" << endl;
  245. }
  246. else{
  247.  
  248. additionalTime = total_minutes - 20;
  249. cout << "The couple will be charged for " << additionalTime << " extra minute(s).\n" << endl;
  250. cout << fixed << showpoint << setprecision(2);
  251. cost2 = chargeC + (((total_minutes) - 20) * 2.50);
  252. cout << "The couple will pay $" << cost2 << " dollars.\n" << endl;
  253. }
  254. }
  255.  
  256. //(12) End of C if
  257.  
  258. //--------------------------------------------------------------------------------
  259. else if(fare=='G'||fare=='g'){
  260.  
  261. cout << "\nWhat hour did the group of customers depart? ";
  262. cin >> hrOut;
  263. cout << "\nWhat minute did the group of customers depart? ";
  264. cin >> minOut;
  265. cout << "\nYou entered for departure: " << hrOut << ":" << minOut << endl;
  266. cout << "\nWhat hour did the group of customers arrive? ";
  267. cin >> hrIn;
  268. cout << "\nWhat minute did the group of customers arrive? ";
  269. cin >> minIn;
  270. cout << "\nYou entered for arrival: " << hrIn << ":" << minIn << "\n" << endl;
  271. cout << "A rickshaw departed at " << hrOut << ":" << minOut
  272. << " and arrived at " << hrIn << ":" << minIn << " with a group of customers.\n" << endl;
  273.  
  274. if(hrIn < hrOut && minIn <= minOut){
  275.  
  276. hours = (hrIn - hrOut) + 23;
  277. cout << "The group of customers arrived in " << hours << " hour(s)";
  278. minutes = (minIn - minOut) + 60;
  279. cout << " and " << minutes << " minute(s)";
  280. total_minutes = (hours * 60) + minutes;
  281. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  282. }
  283. else if(hrOut < hrIn && minOut <= minIn){
  284.  
  285. hours = (hrIn - hrOut);
  286. cout << "The group of customers arrived in " << hours << " hour(s)";
  287. minutes = (minIn - minOut);
  288. cout << " and " << minutes << " minute(s)";
  289. total_minutes = (hours * 60) + minutes;
  290. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  291. }
  292.  
  293. //-----------------------------------------------------//(13) Different if and else but apart of G if
  294. else if(hrIn < hrOut && minOut <= minIn){
  295.  
  296. hours = (hrIn - hrOut) + 24;
  297. cout << "The group of customers arrived in " << hours << " hour(s)";
  298. minutes = (minIn - minOut);
  299. cout << " and " << minutes << " minute(s)";
  300. total_minutes = (hours * 60) + minutes;
  301. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  302. }
  303. else if(hrOut < hrIn && minIn <= minOut){
  304.  
  305. hours = (hrIn - hrOut) - 1;
  306. cout << "The group of customers arrived in " << hours << " hour(s)";
  307. minutes = (minIn - minOut) + 60;
  308. cout << " and " << minutes << " minute(s)";
  309. total_minutes = (hours * 60) + minutes;
  310. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  311. }
  312.  
  313. //-----------------------------------------------------//(14) Different if and else but apart of G if
  314. else if(hrIn <= hrOut && minOut <= minIn){
  315.  
  316. hours = (hrIn - hrOut);
  317. cout << "The group of customers arrived in " << hours << " hour(s)";
  318. minutes = (minIn - minOut);
  319. cout << " and " << minutes << " minute(s)";
  320. total_minutes = (hours * 60) + minutes;
  321. cout << ",\nor in a total of " << total_minutes << " minutes.\n" << endl;
  322. }
  323. if(total_minutes <=15){
  324.  
  325. cout << fixed << showpoint << setprecision(2);
  326.  
  327. cout << "The group of customers will pay $" << chargeG << " dollars.\n" << endl;
  328. }
  329. if(total_minutes > 15 && total_minutes <=30 ){
  330.  
  331. additionalTime = total_minutes - 15;
  332. cout << "The group of customer will be charged for " << additionalTime << " extra minute(s).\n" << endl;
  333. cout << fixed << showpoint << setprecision(2);
  334. cost3 = chargeG + (((total_minutes) - 15) * 4.00);
  335. cout << "The group of customers will pay $" << cost3 << " dollars.\n" << endl;
  336. }
  337.  
  338. if(total_minutes > 30){
  339.  
  340. additionalTime = total_minutes - 15;
  341. cout << "The group customers will be charged for " << additionalTime << " extra minute(s).\n" << endl;
  342. cout << "The group customers will also be charged an additional $50.00 fee for exceeding the time of 30 minutes.\n" << endl;
  343. cout << fixed << showpoint << setprecision(2);
  344. cost4 = chargeG + (((total_minutes) - 15) * 4.00) + 50;
  345. cout << "Which brings the group of customer's total amount of $" << cost4 << " dollars.\n" << endl;
  346. }
  347. }
  348.  
  349. //(15) End of G if
  350.  
  351. //--------------------------------------------------------------------------------
  352. else{
  353. cout << "\nThe character that you have entered was invalid! Please try again!\n" << endl;
  354. }
  355. cout << "Would you like to perform another calculation (Y/N)? ";
  356. cin >> choice;
  357. }
  358.  
  359. //(16) This is my termintation message!
  360.  
  361. cout << "\nI am quite surprised that you are leaving my program so soon,\n"
  362. << "but I will thank you anyways for using my ODUSPORTS calculator!\n" << endl;
  363.  
  364. cout << " TTTTTTT H H A N N K K SSSS !! " << endl;
  365. cout << " T H H A A NN N K K S !! " << endl;
  366. cout << " T HHHH AAAAA N N N KK SSSS !! " << endl;
  367. cout << " T H H A A N NN K K S " << endl;
  368. cout << " T H H A A N N K K SSSS !! " << endl;
  369.  
  370.  
  371.  
  372. system("pause");
  373. return 0;
  374. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement