Advertisement
Guest User

Untitled

a guest
Dec 16th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.66 KB | None | 0 0
  1. // bankomat v2.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6. #include <iostream>
  7. #include <iomanip>
  8. #include <time.h>
  9. #include <fstream>
  10. #include <conio.h>
  11. #include <string.h>
  12. #include <stdlib.h>
  13. #include<process.h>
  14. #include<dos.h>
  15. using namespace std;
  16.  
  17. //==================================================================================================
  18. class Bank //abstract base class
  19. {
  20. public:
  21. double startBalance;
  22. string COKAccountHolders;
  23. double limit;
  24. //virtual bool Deposit(double Dvalue)=0; // manage deposit
  25. //virtual bool Transaction(double Dvalue)=0;// use as necessary
  26. //virtual void Display_accountBalance()=0;// Show the balance in a nice way
  27. //virtual void SetLimit(double NewLimit)=0;
  28. //virtual double GetLimit()=0;
  29.  
  30. };
  31.  
  32.  
  33. //==================================================================================================
  34. class COKAccountHolders :public Bank
  35. {
  36. string accountHolders;
  37. string accountHoldersAddress, branch;
  38. int accountNumber;
  39. double startBalance;
  40. double accountBalance;
  41. double accountInterest;
  42. double amount;
  43. int count;
  44.  
  45. public:
  46. //void Display_accountBalance();
  47. void deposit();
  48. void withdraw();
  49. void details();
  50. void payBills();
  51. void accountExit();
  52. void interest();
  53.  
  54. COKAccountHolders()
  55. {
  56. accountNumber = 5678;
  57. accountHolders = "Tashi, Rakish, Tyrone, Audley, Michael";
  58. accountHoldersAddress = "26 Grove Road, Mandeville";
  59. startBalance = 30000.00;
  60. accountBalance = 0.00;
  61. branch = "Mandeville";
  62. amount = 0;
  63. }
  64. };
  65. //==================================================================================================
  66. void COKAccountHolders::interest()
  67. {
  68. system("cls");
  69.  
  70. cout << "\n==========================COK ACCOUNT INTEREST PAYMENT==========================\n\n";
  71. cout << "\tThe Interest is calculate over the last SIX months on the average account balance\n";
  72. cout << "\n\t\tInterest Rate payable is 10% per annum." << endl;
  73. cout << "\t\tView the accumulated interest? Press 1 for Yes OR 0 for NO.\n\n";
  74.  
  75.  
  76.  
  77. cout << "==========================COK ACCOUNT INTEREST PAYMENT==========================\n\n";
  78.  
  79. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  80. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  81. cout << "\tThe Branch location is :" << branch << "\n\n";
  82. cout << "\tAccount number :" << accountNumber << "\n\n";
  83. cout << "============================+++++++++++++++++++++++============================\n\n";
  84. cout << "\tStarting account balance :$" << startBalance << "\n\n";
  85. cout << "\tPresent available balance :$" << accountBalance << "\n\n";
  86. accountInterest = accountBalance + (accountBalance*1.050);
  87. cout << "\tPresent available balance + interest for 6 months :$" << accountInterest << "\n\n";
  88. cout << "Press any key to Return to the Main Menu\n\n";
  89. system("PAUSE");
  90. }
  91. //==================================================================================================
  92.  
  93.  
  94. //==================================================================================================
  95. void COKAccountHolders::deposit()
  96. {
  97. system("cls");
  98. cout << "\n===========================COK ACCOUNT DEPOSIT SYSTEM==========================\n\n";
  99.  
  100. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  101. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  102. cout << "\tThe Branch location is :" << branch << "\n\n";
  103. cout << "\tAccount number :" << accountNumber << "\n\n";
  104. cout << "============================+++++++++++++++++++++++============================\n\n";
  105. cout << "\tStarting account balance :$" << startBalance << "\n\n";
  106. cout << "\tPresent available balance :$" << accountBalance << "\n\n";
  107. cout << "\tEnter the Amount to be Deposited $";
  108.  
  109. double amount;
  110. cin >> amount;
  111. accountBalance = startBalance + amount;
  112. cout << "\n\tYour new available Balanced Amount is $" << accountBalance << endl;
  113. cout << "\n\t\t\tThank You!\n\n" << endl;
  114. cout << "Press any key to Return to the Main Menu\n\n";
  115. system("PAUSE");
  116. }
  117. //==================================================================================================
  118. void COKAccountHolders::withdraw()//Withdrawal Transactions
  119. {
  120. system("cls");
  121. cout << "\n============================COK ACCOUNT WITHDRAWAL=============================\n\n";
  122.  
  123. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  124. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  125. cout << "\tThe Branch location is :" << branch << "\n\n";
  126. cout << "\tAccount number :" << accountNumber << "\n\n";
  127. cout << "============================+++++++++++++++++++++++============================\n\n";
  128. cout << "\tStarting account balance :$" << startBalance << "\n\n";
  129. cout << "\tPresent available balance :$" << accountBalance << "\n\n";
  130. cout << "\tEnter the Amount to be Withdrawn $";
  131.  
  132. double amount;
  133. cin >> amount;
  134.  
  135. if (amount>accountBalance || amount>9000)//Limit set at $9000 maximum after paying bills
  136. {
  137. system("cls");
  138. cout << "\n============================COK ACCOUNT WITHDRAWAL=============================\n\n";
  139. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  140. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  141. cout << "\tThe Branch location is :" << branch << "\n\n";
  142. cout << "\tAccount number :" << accountNumber << "\n\n";
  143. cout << "============================+++++++++++++++++++++++============================\n\n";
  144. cout << "\n\tInsufficient Available Balance in your account.\n\n" << endl;
  145. cout << "\t\t\tSorry !!\n" << endl;
  146. system("PAUSE");
  147. }
  148. else
  149. {
  150. double b;
  151. accountBalance = startBalance - amount;
  152. system("cls");
  153. cout << "\n============================COK ACCOUNT WITHDRAWAL=============================\n\n";
  154. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  155. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  156. cout << "\tThe Branch location is :" << branch << "\n\n";
  157. cout << "\tAccount number :" << accountNumber << "\n\n";
  158. cout << "============================+++++++++++++++++++++++============================\n\n";
  159. cout << "Your new available Balanced Amount is $" << startBalance << endl;
  160. cout << "Press any key to Return to the Main Menu\n\n";
  161. system("PAUSE");
  162. }
  163.  
  164. }
  165. //==================================================================================================
  166. void COKAccountHolders::payBills()
  167. {
  168. int choice_t;
  169.  
  170. do{
  171. system("cls");
  172. cout << "\n===========================COK BILLS PAYMENT SYSTEM MENU========================\n";
  173. cout << "\t\tEnter (1) for JPS Electricity Bill Payment" << endl;
  174. cout << "\t\tEnter (2) for NWC Water Supplier Bill Payment" << endl;
  175. cout << "\t\tEnter (3) for FLOW Broadcasting Service Bill Payment" << endl;
  176. cout << "\t\tEnter (4) for residentail RENT Payment" << endl;
  177. cout << "\t\tEnter (0) to Exit Bill Payment System" << endl << endl;
  178. cout << "\t\tPLEASE ENTER A SELECTION AND PRESS RETURN KEY: \n\n";
  179. cout << "================================COK MAIN MENU==================================\n\n";
  180.  
  181. cin >> choice_t;
  182.  
  183. switch (choice_t)
  184. {
  185. case 1:
  186. system("cls");
  187. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  188. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  189. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  190. cout << "\tThe Branch location is :" << branch << "\n\n";
  191. cout << "\tAccount number :" << accountNumber << "\n\n";
  192. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  193. cout << "Pay this month's JPS Electric Company electricity bill of $2000.00 now?\n\n";
  194. cout << "\t\t\tPress 1 for Yes OR Press 0 for No\n\n";
  195. int r;
  196.  
  197. cin >> r;
  198. if (r == 1)
  199. {//accountBalance = startBalance-accountBalance;
  200. accountBalance = startBalance - 2000;
  201. system("cls");
  202. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  203. cout << "\n\tYour JPS electricity bill of $2000.00 has been paid.\n\n";
  204. cout << "\tYour account new Available Balanced Amount is $" << accountBalance << endl;
  205. cout << "\n============================+++++++++++++++++++++++===========================\n\n";
  206. cout << "Press any key to Return to the Main Menu\n\n";
  207. }
  208. else
  209. {
  210. system("cls");
  211. cout << "\n==========================COK BILLS PAYMENT SYSTEM============================\n\n";
  212. cout << "\tYour account Available Balanced Amount is $" << startBalance << endl;
  213. cout << "\n\n\tExiting Bill Payment System. Thank you!.\n\n";
  214. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  215. cout << "Press any key to Return to the Main Menu\n\n";
  216. }
  217. system("PAUSE");
  218. break;
  219. case 2:
  220. system("cls");
  221. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  222. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  223. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  224. cout << "\tThe Branch location is :" << branch << "\n\n";
  225. cout << "\tAccount number :" << accountNumber << "\n\n";
  226. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  227. cout << "Pay this month's NWC Water Company water supply bill of $1500.00 now?\n\n";
  228. cout << "\t\t\tPress 1 for Yes OR Press 0 for No\n\n";
  229. int d;
  230.  
  231. cin >> d;
  232. if (d == 1)
  233. {
  234. accountBalance = startBalance - 1500;
  235. system("cls");
  236. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  237. cout << "\n\tYour NWC Water Supply bill of $1500.00 has been paid.\n\n";
  238. cout << "\tYour account new Available Balanced Amount is $" << accountBalance << endl;
  239. cout << "\n============================+++++++++++++++++++++++===========================\n\n";
  240. cout << "Press any key to Return to the Main Menu\n\n";
  241. }
  242. else
  243. {
  244. system("cls");
  245. cout << "\n==========================COK BILLS PAYMENT SYSTEM============================\n\n";
  246. cout << "\tYour account Available Balanced Amount is $" << startBalance << endl;
  247. cout << "\n\n\tExiting Bill Payment System. Thank you!.\n\n";
  248. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  249. cout << "Press any key to Return to the Main Menu\n\n";
  250. }
  251. system("PAUSE");
  252. break;
  253. case 3:
  254. system("cls");
  255. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  256. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  257. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  258. cout << "\tThe Branch location is :" << branch << "\n\n";
  259. cout << "\tAccount number :" << accountNumber << "\n\n";
  260. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  261. cout << "Pay this month's FLOW Braodcasting Company service bill of $3500.00 now?\n\n";
  262. cout << "\t\t\tPress 1 for Yes OR Press 0 for No\n\n";
  263. int f;
  264.  
  265. cin >> f;
  266. if (f == 1)
  267. {
  268. accountBalance = startBalance - 1500;
  269. system("cls");
  270. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  271. cout << "\n\tYour FLOW Broadcasting Service bill of $3500.00 has been paid.\n\n";
  272. cout << "\tYour account new Available Balanced Amount is $" << accountBalance << endl;
  273. cout << "\n============================+++++++++++++++++++++++===========================\n\n";
  274. cout << "Press any key to Return to the Main Menu\n\n";
  275. }
  276. else
  277. {
  278. system("cls");
  279. cout << "\n==========================COK BILLS PAYMENT SYSTEM============================\n\n";
  280. cout << "\tYour account Available Balanced Amount is $" << startBalance << endl;
  281. cout << "\n\n\tExiting Bill Payment System. Thank you!.\n\n";
  282. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  283. cout << "Press any key to Return to the Main Menu\n\n";
  284. }
  285. system("PAUSE");
  286. break;
  287. case 4:
  288. system("cls");
  289. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  290. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  291. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  292. cout << "\tThe Branch location is :" << branch << "\n\n";
  293. cout << "\tAccount number :" << accountNumber << "\n\n";
  294. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  295. cout << "Pay this month's Residential RENT service bill of $14000.00 now?\n\n";
  296. cout << "\t\t\tPress 1 for Yes OR Press 0 for No\n\n";
  297. int g;
  298.  
  299. cin >> g;
  300. if (g == 1)
  301. {
  302. accountBalance = startBalance - 14000;
  303. system("cls");
  304. cout << "\n===========================COK BILLS PAYMENT SYSTEM==========================\n";
  305. cout << "\n\tYour FLOW Broadcasting Service bill of $3500.00 has been paid.\n\n";
  306. cout << "\tYour account new Available Balanced Amount is $" << accountBalance << endl;
  307. cout << "\n============================+++++++++++++++++++++++===========================\n\n";
  308. cout << "Press any key to Return to the Main Menu\n\n";
  309. }
  310. else
  311. {
  312. system("cls");
  313. cout << "\n==========================COK BILLS PAYMENT SYSTEM============================\n\n";
  314. cout << "\tYour account Available Balanced Amount is $" << startBalance << endl;
  315. cout << "\n\n\tExiting Bill Payment System. Thank you!.\n\n";
  316. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  317. cout << "Press any key to Return to the Main Menu\n\n";
  318. }
  319. system("PAUSE");
  320. case 0:
  321. int main();
  322. break;
  323. default:cout << "Please Enter the Correct Number Choice" << endl;
  324. }
  325. } while (choice_t != 0);
  326.  
  327.  
  328. };
  329.  
  330. //==================================================================================================
  331. void COKAccountHolders::details()
  332. {
  333. system("cls");
  334.  
  335. cout << "\n============================COK ACCOUNT DETAILS=============================\n\n";
  336. cout << "\n\nThe Names of the Account Holders are :" << accountHolders << "\n\n";
  337. cout << "\tThe Account Holders' address is :" << accountHoldersAddress << "\n\n";
  338. cout << "\tThe Branch location is :" << branch << "\n\n";
  339. cout << "\tAccount number :" << accountNumber << "\n\n";
  340. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  341. cout << "\tYour account Available Balanced Amount is $" << startBalance << endl;
  342. cout << "============================+++++++++++++++++++++++============================\n\n";
  343. cout << "Press any key to Return to the Main Menu\n\n";
  344. system("PAUSE");
  345. }
  346.  
  347. //==================================================================================================
  348.  
  349. void COKAccountHolders::accountExit()
  350. {
  351. system("cls");
  352.  
  353.  
  354. cout << "\n============================COK ACCOUNT EXIT=============================\n\n";
  355. cout << "\n\n\t\tEXITING...........EXITING...............EXITING\n\n";
  356. cout << "====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  357. cout << "============================+++++++++++++++++++++++============================\n\n";
  358. system("PAUSE");
  359. exit(1);
  360. }
  361.  
  362.  
  363. //==================================================================================================
  364. /*class Bills:public Bank
  365. {
  366.  
  367. double JPS;
  368. double NWC;
  369. double FLOW;
  370. double RENT;
  371. double bills;
  372. void Display_accountBalance();
  373. public:
  374. void jps();
  375. void nwc();
  376. void flow();
  377. void rent();
  378.  
  379. Bills()
  380. {
  381. double JPS = 2000;
  382. double NWC = 1500;
  383. double FLOW = 3500;
  384. double RENT = 14000;
  385.  
  386. }
  387. void Bills::jps()
  388.  
  389. system("cls");
  390.  
  391.  
  392. cout<<"\n============================COK BILL PAYMENT SYSTEM=============================\n\n";
  393. cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";
  394. cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";
  395. cout<<"\tThe Branch location is :"<<branch<<"\n\n";
  396. cout<<"\tAccount number :"<<accountNumber<<"\n\n";
  397. cout<<"====================++THANK YOU FOR MAKING IT COK++============================\n\n";
  398. cout<<"============================+++++++++++++++++++++++============================\n\n";
  399. system("PAUSE");
  400. }
  401.  
  402. };*/
  403. //==================================================================================================
  404.  
  405. class Limits :public Bank
  406. {
  407. public:
  408. void SetLimit(double NewLimit)
  409. {}
  410.  
  411. double Getlimit()
  412. {}
  413.  
  414. };
  415. //==================================================================================================
  416. //==================================================================================================
  417. //==================================================================================================
  418. int main()
  419. {
  420. int e;
  421. COKAccountHolders p;
  422.  
  423. system("Color 1b");
  424. cout << "\n============================WELCOME TO COK==================================\n\n";
  425. cout << "\t\t\t--------------------\n" << endl;
  426. //Prompt to show today's date
  427. cout << "\t\tToday's date is: ";
  428. //Show date and time function
  429. time_t now;
  430. time(&now);
  431.  
  432. printf("%s\n", ctime(&now));;
  433. //Give space for the function of date and time
  434. cout << "\t\t\t--------------------\n" << endl;
  435. cout << "============================WELCOME TO COK==================================\n\n";
  436. //==================================================================================================
  437.  
  438. cout << "\tPress 1 and press Enter to Access your account via pin number\n\n";
  439. cout << "\t\t\t\t\t or \n\n";
  440. cout << "\t\t\tPress 0 and press Enter to get Help.\n\n";
  441.  
  442. int access;
  443. cin >> access;
  444. switch (access)
  445. {
  446. case 1://pin to access account
  447. system("cls"); int i, pin;
  448.  
  449. cout << "\n============================COK ACCOUNT ACCESS==================================\n\n";
  450. cout << "\n\nWhat is your account Pin access Number? Only one attempts allowed.\n\n" << endl;
  451. cout << "============================COK ACCOUNT ACCESS==================================\n\n";
  452. cin >> pin;
  453.  
  454. system("cls");
  455.  
  456. if (pin == 123)
  457.  
  458. {
  459. system("cls");
  460.  
  461. do
  462. {
  463. system("cls");
  464. system("Color 1a");
  465. cout << endl << "\n======================COK Main Menu Screen======================\n" << endl << endl;
  466. cout << "\t\tEnter (1) for Cash Deposit" << endl;
  467. cout << "\t\tEnter (2) for Cash Withdrawal" << endl;
  468. cout << "\t\tEnter (3) for Balance Inquiry" << endl;
  469. cout << "\t\tEnter (4) for Pay Bills" << endl;
  470. cout << "\t\tEnter (5) to Account Interest Payment" << endl;
  471. cout << "\t\tEnter (0) to Exit ATM" << endl << endl;
  472. cout << "\t\tPLEASE ENTER A SELECTION AND PRESS RETURN KEY: \n\n";
  473. cout << "==========================COK MAIN MENU================================\n\n";
  474.  
  475. cin >> e;
  476. switch (e)
  477. {
  478. case 1:
  479. p.deposit();
  480. break;
  481. case 2:
  482. p.withdraw();
  483. break;
  484. case 3:
  485. p.details();
  486. break;
  487. case 4:
  488. p.payBills();
  489. break;
  490. case 5:
  491. p.interest();
  492. break;
  493. case 0:
  494. p.accountExit();
  495. break;
  496. default:cout << "Please Enter the Correct Number Choice" << endl;
  497. }
  498. } while (e != 0);
  499.  
  500. break;
  501. }
  502.  
  503. else
  504. {
  505. system("cls");
  506. system("Color 1c");
  507. cout << "\n===========================THANKS FOR MAKING IT COK===========================\n\n";
  508. cout << "\nYou had made three attempts which failed!!! No More attemps allowed!! Sorry!!\n\n";
  509. cout << "===========================THANKS FOR MAKING IT COK===========================\n\n";
  510.  
  511. system("PAUSE");
  512. exit(1);
  513. }
  514. //==================================================================================================
  515.  
  516.  
  517. case 0://pin to access account
  518. system("cls");
  519. cout << "\n==========================COK ACCOUNT STATUS================================\n\n";
  520. cout << "\tYou must have the correct pin number to access this acount. See your\n\n";
  521. cout << "\t bank representative for assistance during bank opening hours\n\n";
  522. cout << "\t\tThanks for making it COK, your choice today!!\n\n";
  523. cout << "==========================COK ACCOUNT STATUS================================\n\n";
  524. system("PAUSE");
  525. exit(1);
  526. break;
  527. //==================================================================================================
  528. }
  529.  
  530. system("PAUSE");
  531. return 0;
  532.  
  533. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement