Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Account.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include "pch.h"
- #include <iostream>
- #include "Account.h"
- #include "SavingsAccount.h"
- #include "CheckingAccount.h"
- #include <vector>
- using namespace std;
- int main()
- {
- Account a(50), b(-3);
- cout << "Balance a: " << a.getBalance() << ", b: " << b.getBalance() << endl;//", c: " << c.getBalance() << endl;
- a.credit(10);
- b.credit(10);
- //c.credit(15);
- cout << "Balance a: " << a.getBalance() << ", b: " << b.getBalance() << endl;//", c: " << c.getBalance() << endl;
- a.debit(5);
- b.debit(5);
- //c.debit(5);
- cout << "Balance a: " << a.getBalance() << ", b: " << b.getBalance() << endl;//", c: " << c.getBalance() << endl;
- SavingsAccount d(50,0.3), e(-3,0.3);
- cout << "Balance d: " << d.getBalance() << ", e: " << e.getBalance() << endl;//", f: " << f.getBalance() << endl;
- cout << "Interest d: " << d.calculateInterest() << ", e: " << e.calculateInterest() << endl;
- d.credit(10);
- e.credit(10);
- //f.credit(15);
- cout << "Balance d: " << d.getBalance() << ", e: " << e.getBalance() << endl;//", f: " << f.getBalance() << endl;
- d.debit(5);
- e.debit(5);
- //f.debit(5);
- cout << "Balance d: " << d.getBalance() << ", e: " << e.getBalance() << endl;//", f: " << f.getBalance() << endl;
- CheckingAccount g(50,2), h(-3,2);
- cout << "Balance g: " << g.getBalance() << ", h: " << h.getBalance() << endl;//", i: " << i.getBalance() << endl;
- g.credit(10);
- h.credit(10);
- //i.credit(15);
- cout << "Balance g: " << g.getBalance() << ", h: " << h.getBalance() << endl;//", i: " << i.getBalance() << endl;
- g.debit(5);
- h.debit(5);
- //i.debit(5);
- cout << "Balance g: " << g.getBalance() << ", h: " << h.getBalance() << endl;//", i: " << i.getBalance() << endl;
- Account *s1 = new SavingsAccount(50, 0.3);
- cout << "Balance *s1: " << s1->getBalance() << endl;//", interest *s1: " << s1->calculateInterest << endl;
- Account *s2 = new CheckingAccount(70, 2);
- cout << "Balance *s2: " << s2->getBalance() << endl;
- vector<Account *> listAccount;
- listAccount.push_back(new SavingsAccount(60, 0.5));
- listAccount.push_back(new CheckingAccount(90, 3));
- for (Account *account : listAccount)
- cout << "Balance: " << account->getBalance() << endl;
- delete(s1);
- delete(s2);
- }
- // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
- // Debug program: F5 or Debug > Start Debugging menu
- // Tips for Getting Started:
- // 1. Use the Solution Explorer window to add/manage files
- // 2. Use the Team Explorer window to connect to source control
- // 3. Use the Output window to see build output and other messages
- // 4. Use the Error List window to view errors
- // 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
- // 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