Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. class account {
  8. private:
  9. double acc_ID;
  10. double acc_balance;
  11.  
  12. private:
  13. string acc_type, acc_Date = " 25/4/2018";
  14.  
  15. public:
  16. account() : acc_ID(0), acc_balance(0){};
  17. account(double acc_num)
  18. {
  19. acc_ID = acc_num;
  20. acc_balance = 15000;
  21. }
  22.  
  23. void set_acc_info()
  24. {
  25. cout << " Enter Your acc_ID " << endl;
  26. cin >> acc_ID;
  27. cout << " Enter Your new Balance : " << endl;
  28. cin >> acc_balance;
  29. cout << " What is the type of Account " << endl;
  30. cin >> acc_type;
  31. cout << " your account was Created " << acc_Date << endl;
  32. }
  33.  
  34. virtual double Show_acc_balance(account a)
  35. {
  36. return a.acc_balance;
  37. }
  38.  
  39. virtual double Show_acc_balance(double amount)
  40. {
  41. if (amount > this->acc_balance) {
  42. cout << "Error: Deducted amount is greater than account balance" << endl;
  43. return NULL;
  44. }
  45.  
  46. return this ->acc_balance -= amount;
  47. }
  48. };
  49.  
  50. class branch : public account
  51. {
  52. private:
  53. string Branch_name = "Helwan", Branch_address=" street Ahmed Latef";
  54. int Branch_ID = 5595-44440-41721-5555, acc_ID, count = 0;
  55.  
  56. public:
  57. void Get_acc_Data(int accc_id)
  58. {
  59. account *client[100];
  60. acc_ID = accc_id;
  61. client[count] = new account (acc_ID);
  62. client[count]->Show_acc_balance(acc_ID);
  63. }
  64. void transfer()
  65. {
  66. int transfer_acc_ID, transfer_amount;
  67.  
  68. cout << "Enter ACC ID that you want to transfer" << endl;
  69. cin >> transfer_acc_ID;
  70. cout << "Enter amount that you want to tranfer" << endl;
  71. cin >> transfer_amount;
  72. }
  73. void Deposite()
  74. {
  75. int Deposite_acc_ID, Deposite_amount;
  76.  
  77. cout << "Enter ACC ID to Deposite on it" << endl;
  78. cin >> Deposite_acc_ID;
  79. account access_account;
  80. cout << " Avaliable : " << access_account.Show_acc_balance(Deposite_acc_ID) << endl;
  81. cout << "Enter Amount that you want to Deposite " <<endl;
  82. cin >> Deposite_amount;
  83.  
  84. }
  85.  
  86. };
  87.  
  88. class ATM :public branch
  89. {
  90. public:
  91. double Card_num,accc_ID, n = 0;
  92.  
  93.  
  94. void Get_Debit_card_Data()
  95. {
  96. cout << "Please Enter you Card num " << endl;
  97. cin >> Card_num;
  98. cout << " \n " << endl;
  99. cout << "please Enter Your account id " << endl;
  100. cin >> accc_ID;
  101. cout << " \n " << endl;
  102.  
  103.  
  104. }
  105.  
  106. account access_account;
  107.  
  108. void balance_inquiry()
  109. {
  110.  
  111. cout << "\n 'EGP Balance inquiry' " << endl;
  112. cout << " Account : \n" << setw(18) << accc_ID << endl;
  113. cout << " \n" << " Current Available : " << access_account.Show_acc_balance(access_account) << setw(5) << " EGP" << endl;
  114. cout << "\n Thank You For Using ATM CASH 24 Services " << endl;
  115. cout << " 1/5/2018" << setw(22) << " 1:58:18 A.M" << endl;
  116. //cout << "Your Balance is : " << endl;
  117. }
  118. void withdrawl()
  119. {
  120. account access_account(accc_ID);
  121. double withdrawl_amount;
  122. cout << "Please Enter withdrawl Amount : " << endl;
  123. cin >> withdrawl_amount;
  124. cout << " \n " << endl;
  125.  
  126.  
  127. cout << " \n " << endl;
  128. cout << "Card : " << Card_num << endl;
  129. cout << "\n 'EGP Withdrawl' " << endl;
  130. cout << " Account : \n" << setw(18) << accc_ID << endl;
  131. cout << " \n" << " Current Available : " << access_account.Show_acc_balance(access_account) << setw(5) << " EGP" << endl;
  132. cout << " \n" << " Amount : " << withdrawl_amount << setw(5) << " EGP" << endl;
  133.  
  134. cout << " \n" << " Available After withdrawl : " << access_account.Show_acc_balance(withdrawl_amount) << setw(5) << " EGP" << endl;
  135. cout << access_account.Show_acc_balance(access_account) << endl;
  136. cout << "\n Thank You For Using ATM CASH 24 Services " << endl;
  137. cout << " 1/5/2018" << setw(22) << " 1:58:18 A.M" << endl;
  138.  
  139.  
  140. }
  141.  
  142. };
  143.  
  144. class client : public ATM
  145. {
  146. int client_ID, client_phone_No;
  147. string client_name, client_address;
  148.  
  149. };
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156. int main(){
  157.  
  158. client c1;
  159. c1.Get_Debit_card_Data();
  160. c1.balance_inquiry();
  161. cout << "\n \n \n " << endl;
  162. c1.withdrawl();
  163. cout << "\n \n \n " << endl;
  164. c1.balance_inquiry();
  165. // c1.Deposite();
  166. cout << "\n \n \n " << endl;
  167. // c1.transfer();
  168.  
  169. return 0;
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement