Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. // Account.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. #include "Account.h"
  7. #include "SavingsAccount.h"
  8. #include "CheckingAccount.h"
  9. #include <vector>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15. Account a(50), b(-3);
  16. cout << "Balance a: " << a.getBalance() << ", b: " << b.getBalance() << endl;//", c: " << c.getBalance() << endl;
  17. a.credit(10);
  18. b.credit(10);
  19. //c.credit(15);
  20. cout << "Balance a: " << a.getBalance() << ", b: " << b.getBalance() << endl;//", c: " << c.getBalance() << endl;
  21. a.debit(5);
  22. b.debit(5);
  23. //c.debit(5);
  24. cout << "Balance a: " << a.getBalance() << ", b: " << b.getBalance() << endl;//", c: " << c.getBalance() << endl;
  25.  
  26. SavingsAccount d(50,0.3), e(-3,0.3);
  27. cout << "Balance d: " << d.getBalance() << ", e: " << e.getBalance() << endl;//", f: " << f.getBalance() << endl;
  28. cout << "Interest d: " << d.calculateInterest() << ", e: " << e.calculateInterest() << endl;
  29. d.credit(10);
  30. e.credit(10);
  31. //f.credit(15);
  32. cout << "Balance d: " << d.getBalance() << ", e: " << e.getBalance() << endl;//", f: " << f.getBalance() << endl;
  33. d.debit(5);
  34. e.debit(5);
  35. //f.debit(5);
  36. cout << "Balance d: " << d.getBalance() << ", e: " << e.getBalance() << endl;//", f: " << f.getBalance() << endl;
  37.  
  38. CheckingAccount g(50,2), h(-3,2);
  39. cout << "Balance g: " << g.getBalance() << ", h: " << h.getBalance() << endl;//", i: " << i.getBalance() << endl;
  40. g.credit(10);
  41. h.credit(10);
  42. //i.credit(15);
  43. cout << "Balance g: " << g.getBalance() << ", h: " << h.getBalance() << endl;//", i: " << i.getBalance() << endl;
  44. g.debit(5);
  45. h.debit(5);
  46. //i.debit(5);
  47. cout << "Balance g: " << g.getBalance() << ", h: " << h.getBalance() << endl;//", i: " << i.getBalance() << endl;
  48.  
  49. Account *s1 = new SavingsAccount(50, 0.3);
  50. cout << "Balance *s1: " << s1->getBalance() << endl;//", interest *s1: " << s1->calculateInterest << endl;
  51. Account *s2 = new CheckingAccount(70, 2);
  52. cout << "Balance *s2: " << s2->getBalance() << endl;
  53.  
  54. vector<Account *> listAccount;
  55. listAccount.push_back(new SavingsAccount(60, 0.5));
  56. listAccount.push_back(new CheckingAccount(90, 3));
  57.  
  58. for (Account *account : listAccount)
  59. cout << "Balance: " << account->getBalance() << endl;
  60.  
  61. delete(s1);
  62. delete(s2);
  63. }
  64.  
  65. // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
  66. // Debug program: F5 or Debug > Start Debugging menu
  67.  
  68. // Tips for Getting Started:
  69. // 1. Use the Solution Explorer window to add/manage files
  70. // 2. Use the Team Explorer window to connect to source control
  71. // 3. Use the Output window to see build output and other messages
  72. // 4. Use the Error List window to view errors
  73. // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
  74. // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement