Assignment 3
Assignment 3
Kanishk Tomar
23BCE10588
Implement below given problem in C++: Supporting Code has been given. You need to
submit pdf
file of runnable code. This is the work against class dated on 30th July 2024.
Assume that a bank maintains two kinds of account for its customers, one called
saving account and the other current account. The saving account provides
compound interest and withdrawal facilities but no cheque book facility. The
current account provides cheque book facility but no interest. Current account
holders should also maintain a minimum balance falls below this level, a service
charge is imposed. Create a class Account that stores customer name, account
number, and l type of account. From this device the classes Curr-acct and Sav-
acct to make them more specific to their requirements. Include the necessary
// Base class
class Account {
protected:
string customer_name;
int account_number;
string account_type;
double balance;
public:
// Method to initialize account details
void initialize(string name, int acc_num, string acc_type, double bal) {
customer_name = name;
account_number = acc_num;
account_type = acc_type;
balance = bal;
}
public:
// Method to initialize savings account details
void initialize(string name, int acc_num, double bal, double rate) {
Account::initialize(name, acc_num, "Savings", bal);
interest_rate = rate;
}
public:
// Method to initialize current account details
void initialize(string name, int acc_num, double bal, double min_bal, double pen) {
Account::initialize(name, acc_num, "Current", bal);
minimum_balance = min_bal;
penalty = pen;
}
int main() {
// Example for Savings Account
Sav_acct savings;
savings.initialize("John Doe", 1001, 5000.0, 4.0);
savings.deposit(1000.0);
savings.compute_interest();
savings.withdraw(2000.0);
savings.display_balance();
return 0;
}