Guest User

Untitled

a guest
Jul 16th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. void createAccount(vector<Account*> &theAcc, vector<Customer> &theCust)
  2. {
  3. findCustomer(theCust);
  4.  
  5. bool done = true;
  6. cout<<"<S>aving Account or <C>hecking Account "<<endl;
  7. string ansAccount;
  8. cout<<"Choice (S/C): "<<flush;
  9. cin>>ansAccount;
  10. cin.ignore(1,'\n');
  11. cout<<endl;
  12. while(done)
  13. {
  14. cout<<"Enter the amount to save : "<<flush;
  15. double accountBalance;
  16. cin>>accountBalance;
  17. if(accountBalance < 250)
  18. {
  19. cout<<"---Insufficient Amount entered---"<<endl;
  20. cout<<"Do you want to re-entered <Y/N>? "<<flush;
  21. string ansAmount;
  22. cin>>ansAmount;
  23. if(ansAmount == "N" || ansAmount == "n")
  24. done = false;
  25. }
  26. else
  27. {
  28. cout<<"Enter the date : "<<flush;
  29. string dateOpened;
  30. cin>>dateOpened;
  31. if(ansAccount == "S")
  32. {
  33. Account *SaveAcc = new SavingsAccount(accountBalance,
  34. dateOpened, 0.05);
  35. //theCust->addAccount(SaveAcc);
  36. theAcc.push_back(SaveAcc);
  37.  
  38. cout<<"Account Added Succesfull"<<endl;
  39. }
  40. else if(ansAccount == "C")
  41. {
  42. cin.ignore(1,'\n');
  43. cout<<"Enter the Cheque Style : "<<flush;
  44. string chequeStyle;
  45. cin>>chequeStyle;
  46. Account *CheckAcc = new CheckingAccount(accountBalance,
  47. dateOpened, chequeStyle, 1000.0);
  48. theAcc.push_back(CheckAcc);
  49. }
  50. else
  51. {
  52. cout<<"---Wrong Account Input---"<<endl;
  53. cout<<"--Create Account aborted--"<<endl;
  54. }
  55. done = false;
  56. }
  57. }
  58. }
Add Comment
Please, Sign In to add comment