Page 1 of 1

I provided the code to the 1st part, please set the answer to one single code 2. Derive the class Account_Check from the

Posted: Fri Apr 29, 2022 7:03 am
by answerhappygod
I provided the code to the 1st part, please set the
answer to one single code
2. Derive the class Account_Check from the class Account to
store the account number and the balance from the base class. A
customer with Account_Check typically receives interest, maintains
a minimum balance, and pays service charges if the balance falls
below the minimum balance. Add member variables to store this
additional information. Make sure to override all the virtual
functions of Account Class into Account_Check class. In addition,
add an object of Client_Information class (as given in Part 3
below) as a member of Account_Check class to maintain information
of the client who owns the account. To summarize, this class should
have to following attributes: 3 | Page Interest_rate, minimum
balance allowed, service charges, date of account opening (DateType
object), Customer information (Client_Information object) Add the
following operations in your class
A. A default constructor
B. A constructor that sets all variables of the class
C. Function to set the interest rate
D. Function to retrieve the interest rate
E. Function to set the minimum balance
F. Function to retrieve the minimum balance
G. Function to set the service charges
H. Function to retrieve the service charges
I. Function to check if the balance is less than the minimum
balance
#include <iostream>
using namespace std;
class Account
{
int Account_Num;
double Account_Balance;
public:
Account()
{
Account_Num = 0;
Account_Balance =
0.0;
}
Account(int AN, double AB)
{
Account_Num = AN;
Account_Balance =
AB;
}
void SetAccountNum(int val)
{
Account_Num =
val;
}
int FindAccountNum()
{
return
Account_Num;
}
void SetAccountBalance(double val)
{
Account_Balance =
val;
}
double findAccountBal()
{
return
Account_Balance;
}
void addMoney(double amount)
{
Account_Balance +=
amount;
}
void withdrawMoney(double amount)
{
if (Account_Balance -
amount >= 0)
{
Account_Balance -= amount;
}
else {
cout << "Not sufficient balance " << endl;
}
}
void showData()
{
cout <<
endl;
cout <<
"Account Number: " << Account_Num << endl;
cout <<
"Current account balance: " << Account_Balance <<
endl;
}
};
int main() {
Account a1;
Account a2(7 , 45);
a1.SetAccountNum(3);
a1.SetAccountBalance(78);
cout << a1.FindAccountNum() <<
endl;
cout << a1.FindAccountNum() <<
endl;
a1.addMoney(5.0);
a1.withdrawMoney(3.0);
a1.showData();
a2.addMoney(12);
a2.withdrawMoney(4);
a2.showData();
}