Topics: Carriage return, Interest, C++ Pages: 4 (684 words) Published: August 14, 2013
Name: Zachary Quek Suan ChiehI.D.: 112051-06965-010Course: BCS

using namespace std;
class Account{protected: double balance;
public: Account(double x){
balance = x;}
virtual double getBalance();
virtual double debit(double x);
virtual double credit(double x);};

using namespace std;
double Account:: debit(double x){
cout << "Debit amount exceeded account balance." << endl;}
else{balance = balance - x;}
return balance;}
double Account:: credit(double x){
balance = balance + x;
return balance;}
double Account::getBalance(){
return balance;};

using namespace std;
class SavingAccount : public Account {
double interest;
SavingAccount(double x,double y);
double calculateInterenst(double x);};

using namespace std;
SavingAccount::SavingAccount(double x, double y): Account(x){ balance =x ;
interest =y;}
double SavingAccount::calculateInterenst(double x){
x = balance * interest;
return x;}

using namespace std;
class CheckingAccount : public Account{
private: double fee;
public: CheckingAccount(double x, double y);
virtual double debit(double x);
virtual double credit(double x);};
using namespace std;
CheckingAccount :: CheckingAccount(double x, double y): Account(x){ balance =x ;
fee =y;}
double CheckingAccount :: debit(double x){
if(x>balance){cout << "Debit amount exceeded account balance." << endl;}
balance = balance - x;
cout << "$" << fee << " transaction fee charged." << endl;
balance = balance - fee;
return balance;}}
double CheckingAccount :: credit(double x){
balance = balance + x;...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay about Comparison of Aaca and Apa Ethic Codes
  • The Code of the Street Essay
  • Linear Block Codes Essay
  • Essay on Assigning EM Codes
  • Comparing the Aca and Aacc Code of Ethics Research Paper
  • Code of Ethics Comparison Essay
  • Assigning Evaluation and Management Codes
  • Aicpa vs Ima Length of code Essay

Become a StudyMode Member

Sign Up - It's Free