// Class implementation file: account.cpp #include "account.h" // Implementation section // By default, let's start the new customer with no money, // and a 4% interest rate. account::account() { balance = 0.00; rate = 4.00; } // Initialize the balance based on some initial value // given in the call to this constructor. The interest // rate depends on the initial balance. account::account(float initial_balance) { balance = initial_balance; if (balance > 1000.00) rate = 5.00; else rate = 4.00; } account::account(const account &a) { balance = a.balance; rate = a.rate; } float account::deposit(float amount) { balance = balance + amount; return balance; } float account::withdraw(float amount) { // If there is not enough money, we return the special // value -1 to signify an error. if (amount > balance) return -1; else { balance = balance - amount; return balance; } } float account::get_balance() { return balance; } account& account::operator = (const account &a) { balance = a.balance; return *this; }