Advertisement
Koykoy200078

Com. Prog 2 Project - Simple C++ System

May 26th, 2020
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.17 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. void doc (float amount, int cash, int change);
  6. void info();
  7.  
  8. int main ()
  9. {
  10. float st1 = 0, st2 = 0, st3 = 0, st4 = 0, st5 = 0;
  11. int q1 = 0, q2 = 0, q3 = 0, q4 = 0, q5 = 0;
  12. int order;
  13. float amount = 0, cash = 0, change = 0;
  14.  
  15. // PRICES
  16. double a1 = 45.00, a2 = 50.00, a3 = 55.00, a4 = 99.00, a5 = 99.00;
  17.  
  18. string m1 = "Regular Crispy Fries & Vanilla Cone Twirl";
  19. string m2 = "Spaghetti w/ Regular Iced Tea";
  20. string m3 = "Burger Steak w/ Regular Iced Tea";
  21. string m4 = "Fried Chicken w/ Regular Fries & Regular Iced Tea";
  22. string m5 = "Fried Chicken w/ Macaroni Soup & Regular Iced Tea ";
  23. fstream my;
  24.  
  25. my.open("receipt.doc", ios::app | ios::in | ios::out );
  26.  
  27. here:
  28. do
  29. {
  30. system("cls");
  31. cout << "\t\t-------------------------------------------" << endl;
  32. cout << "\t\t||---------------------------------------||" << endl;
  33. cout << "\t\t|| WELCOME TO ORDERING SYSTEM ||" << endl;
  34. cout << "\t\t||---------------------------------------||" << endl;
  35. cout << "\t\t-------------------------------------------" << endl;
  36. cout << endl;
  37. cout << "-------------------------------- M E N U -------------------------------" << endl;
  38. cout << "|| ||" << endl;
  39. cout << "|| 1. Regular Crispy Fries & Vanilla Cone Twirl = 45.00 PHP ||" << endl;
  40. cout << "|| 2. Spaghetti w/ Regular Iced Tea = 50.00 PHP ||" << endl;
  41. cout << "|| 3. Burger Steak w/ Regular Iced Tea = 55.00 PHP ||" << endl;
  42. cout << "|| 4. Fried Chicken w/ Regular Fries & Regular Iced Tea = 99.00 PHP ||" << endl;
  43. cout << "|| 5. Fried Chicken w/ Macaroni Soup & Regular Iced Tea = 99.00 PHP ||" << endl;
  44. cout << "|| 6. DONE! ||" << endl;
  45. cout << "------------------------------------------------------------------------" << endl;
  46. amount = st1 + st2+ st3 + st4 + st5;
  47. cout << "|| Your total amount = P "<< amount << " ||" << endl;
  48. cout << "------------------------------------------------------------------------" << endl;
  49. cout << endl << endl;
  50. cout << "View Info: Enter 0" << endl;
  51. cout << endl << "Hello there!, Welcome to Chicks' Resto! What is your order? ";
  52. cin >> order;
  53. cout << "\n";
  54.  
  55. switch (order)
  56. {
  57. case 0:
  58. system ("PAUSE");
  59. system ("CLS");
  60. info();
  61. system ("PAUSE");
  62. system ("CLS");
  63. goto here;
  64. break;
  65. case 1:
  66. cout << "How many orders? \n";
  67. cin >> q1;
  68. cout << endl;
  69. cout << "\nYou Order " << q1 << " meal/s of Regular Crispy Fries & Vanilla Cone Twirl = " << a1 <<" PESOS" << endl;
  70. cout << endl;
  71. st1 = q1 * a1;
  72. cout << "Your total expense is: "<< st1 <<" PESOS"<<endl;
  73. cout << endl;
  74. break;
  75.  
  76. case 2:
  77. cout << "How many orders? \n";
  78. cin >>q2;
  79. cout << endl;
  80. cout << "You Order " << q2 << " meal/s of Spaghetti w/ Regular Iced Tea = " << a2 <<" PESOS" <<endl;
  81. cout << endl;
  82. st2 = q2 * a2;
  83. cout << "Your total expense is: "<< st2 <<" PESOS"<<endl;
  84. cout << endl;
  85. break;
  86.  
  87. case 3:
  88. cout << "How many orders? \n";
  89. cin >>q3;
  90. cout << endl;
  91. cout << "You Order " << q3 << " meal/s of Burger Steak w/ Regular Iced Tea = "<< a3 <<" PESOS"<<endl;
  92. cout << endl;
  93. st3 = q3 * a3;
  94. cout << "Your total expense is: "<< st3 <<" PESOS"<<endl;
  95. cout << endl;
  96. break;
  97.  
  98. case 4:
  99. cout << "How many orders? \n";
  100. cin >>q4;
  101. cout << endl;
  102. cout << "You Order " << q4 << " meal/s of Fried Chicken w/ Regular Fries & Regular Iced Tea = "<< a4 <<" PESOS"<<endl;
  103. cout << endl;
  104. st4 = q4 * a4;
  105. cout << "Your total expense is: "<< st4 <<" PESOS"<<endl;
  106. cout << endl;
  107. break;
  108.  
  109. case 5:
  110. cout << "How many orders? \n";
  111. cin >>q5;
  112. cout << endl;
  113. cout << "You Order " << q5 << " meal/s of Fried Chicken w/ Macaroni Soup & Regular Iced Tea = "<< a5 <<" PESOS"<<endl;
  114. cout << endl;
  115. st5 = q5 * a5;
  116. cout << "Your total expense is: "<< st5<<" PESOS"<<endl;
  117. cout << endl;
  118. break;
  119.  
  120. case 6:
  121. cout<<"\nTotal cash: P";
  122. cin>>cash;
  123.  
  124. if(cash < amount)
  125. {
  126. do
  127. {
  128. cout << endl;
  129. cout << "ERROR!! Please Add Cash\n";
  130. system ("pause");
  131. system ("cls");
  132. amount = st1 + st2 + st3 + st4 + st5;
  133. cout << "\nYour total amount is P" << amount;
  134. cout << "\n\n";
  135. cout << "Cash: ";
  136. cin >> cash;
  137. } while(cash < amount);
  138. }
  139. change = cash - amount;
  140. cout << "Your change will be P" << change;
  141. cout << "\n\nThank you for ordering!, please come again soon! ??";
  142. cout << "\n\n";
  143.  
  144. string line="*****************************************";
  145. string msg =" Chiks' FastMeal Resto";
  146. my << "\n\n";
  147. my << line << endl;
  148. my << msg << endl;
  149. my << endl;
  150. my << "Cashier Name: Group 3\n\n";
  151. if (st1 > 0 ){
  152. my << m1 << q1 << " pc./s " << st1 << ".0 Php" << endl;
  153. }
  154.  
  155. if (st2 > 0 ){
  156. my << m2 << q2 << " pc./s " << st2 << ".0 Php" << endl;
  157. }
  158.  
  159. if (st3 > 0 ){
  160. my << m3 << q3 <<" pc./s " << st3 << ".0 Php" << endl;
  161. }
  162.  
  163. if (st4 > 0 ){
  164. my << m4 << q4 << " pc./s " << st4 << ".0 Php" << endl;
  165. }
  166.  
  167. if (st5 > 0 ){
  168. my << m5 << q5 << " pc./s " << st5 << ".0 Php" << endl;
  169. }
  170.  
  171. my << "\n\n";
  172. my << "Total: "<< amount <<".0 Php"<< endl;
  173. my << "Cash: "<< cash << ".0 Php" << endl;
  174. my << "Change: "<< change << ".0 Php" << endl << endl << endl;
  175. my << "THANK YOU! COME AGAIN!\n";
  176. my << line << endl;
  177.  
  178. st1 = 0, st2 = 0, st3 = 0, st4 = 0, st5 = 0;
  179. q1 = 0, q2 = 0, q3 = 0, q4 = 0, q5 = 0;
  180. amount = 0;
  181. cash = 0;
  182. change = 0;
  183.  
  184. system ("pause");
  185. }
  186. }
  187. while (order != 0);
  188. my.close();
  189. return 0;
  190. }
  191.  
  192. void info()
  193. {
  194. cout << "-------------------------------------------------------" << endl;
  195. cout << "||---------------------------------------------------||" << endl;
  196. cout << "|| SIMPLE C++ SYSTEM PROGRAM ||" << endl;
  197. cout << "||---------------------------------------------------||" << endl;
  198. cout << "|| Section: || Subject: || Schedule: ||" << endl;
  199. cout << "|| BSINT-A || Com. Prog. 2 || 8:30-10:00 AM (TTH) ||" << endl;
  200. cout << "||---------------------------------------------------||" << endl;
  201. cout << "-------------------------------------------------------" << endl;
  202. cout << endl;
  203. cout << "-------------------------------------------------------" << endl;
  204. cout << "|| MEMBERS ||" << endl;
  205. cout << "-------------------------------------------------------" << endl;
  206. cout << endl;
  207. cout << "-------------------------------------------------------" << endl;
  208. cout << "|| ||" << endl;
  209. cout << "|| CALABROSO, TEDDY GLENBOY ||" << endl;
  210. cout << "|| ||" << endl;
  211. cout << "|| CARVAJAL, CHRISTIAN FRANC ||" << endl;
  212. cout << "|| ||" << endl;
  213. cout << "|| CRISOSTOMO, CARMELA JANE ||" << endl;
  214. cout << "|| ||" << endl;
  215. cout << "|| DESCALLAR, MARIELE ||" << endl;
  216. cout << "|| ||" << endl;
  217. cout << "|| EJERCITO, AHLLYSA ||" << endl;
  218. cout << "|| ||" << endl;
  219. cout << "|| ETOM, DARYL ANTHONY ||" << endl;
  220. cout << "|| ||" << endl;
  221. cout << "|| GELE, NIñA LYNN ||" << endl;
  222. cout << "|| ||" << endl;
  223. cout << "-------------------------------------------------------" << endl;
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement