Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "account.h"
- using namespace std;
- Account::Account(int initial)
- {
- if (initial >= 0){
- credit(initial);
- }
- else {
- balance = 0;
- cout << "invalid input for balance" << endl;
- };
- }
- void Account::credit(int amount)
- {
- balance += amount;
- }
- void Account::debit(int amount)
- {
- if (amount > balance){
- cout << "Debit amount exceeded account balance" << endl;
- }else{
- balance -= amount;
- }
- }
- int Account::getBalance()
- {
- return balance;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement