Account (Use Classes) OOP
Posted by JanWan
Last Updated: November 02, 2012
Object Oriented Programming

Write the solution for the problem below. You are required to submit three (3) files, Account.h, Account.cpp, and Tester.cpp.

Question:

The Bank of Nova Scotia has asked you to develop a system which should be able to represent customers’ bank accounts. You were instructed to create a class called Account, to facilitate this request. Include data members of type: double to represent the account balance, and string to represent the name of the account holder. Provide a constructor that receives an initial balance, and an account holder’s name, and uses this information to initialize the data members. Please note, that the constructor should validate the initial balance to ensure that it’s greater than or equal to 0. If not, set the balance to 0 and display an error message indicating the initial balance was invalid.

Four (4) member functions are needed:
creditUpdate: this function should add an amount to the current balance
debitUpdate: this function should withdraw money from the account and ensure that the debit amount does not exceed the Account’s balance. If it does, the balance should be left unchanged and a message should be printed indicating, “The Debit amount of $XXX.XX exceeded your current account balance”

interestCal:
this function should award a 10% interest to the current balance of the account holder.

printInfo ():
this function should print the current balance and name of the account holder.

Note:
Use getters and setters to access and manipulate the private data members.
Create a program called Tester.cpp, which executes the statements below. The console output should have the same values as the one to the right.

Account holder1(100.50, "Damion Mitchell");
Account holder2(200.00, "Syrie Mitchell");
holder1.printInfo();

holder1.creditUpdate(19.50);
holder1.printInfo();

holder2.interestCal();
holder2.printInfo();
holder2.debitUpdate(221.00);
holder2.printInfo();

Account holder3(-0.65, "Jane Doe");
holder3.printInfo();
holder3.creditUpdate(1000.00);
holder3.debitUpdate(500.00);
holder3.interestCal();
holder3.printInfo();

The result should be like this:


J.W. PRODUCTION

Related Content
Account Class in C++
Account Class in C++
Samath | Jan 07, 2021
Bank Account in Python
Bank Account in Python
Samath | Apr 23, 2015