Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include #include #include using namespace std; / / Base class for all types of clients class Client { protected: string name; string

#include
#include
#include
#include
#include
#include
using namespace std;
// Base class for all types of clients
class Client {
protected:
string name;
string address;
string phone;
string id;
string password;
double balance;
public:
Client(string name, string address, string phone, string id, string password)
: name(name), address(address), phone(phone), id(id), password(password), balance(0){}
virtual void deposit(double amount){
balance += amount;
cout << "Deposit successful. New balance: "<< balance << endl;
}
virtual void withdraw(double amount){
if (amount > balance){
cout << "Insufficient funds." << endl;
} else {
balance -= amount;
cout << "Withdrawal successful. New balance: "<< balance << endl;
}
}
virtual void viewBalance(){
cout << "Account Balance: "<< balance << endl;
}
virtual void transfer(Client& recipient, double amount){
if (amount > balance){
cout << "Insufficient funds." << endl;
} else {
balance -= amount;
recipient.deposit(amount);
cout << "Transfer successful. New balance: "<< balance << endl;
}
}
virtual void viewTransactionHistory(){
// Implement transaction history retrieval
cout << "Transaction History" << endl;
}
};
// Derived class for User Clients
class UserClient : public Client {
private:
string cnic;
double dailyWithdrawalLimit;
string cardNumber;
string pin;
public:
UserClient(string name, string address, string phone, string cnic, string id, string password, double dailyWithdrawalLimit)
: Client(name, address, phone, id, password), cnic(cnic), dailyWithdrawalLimit(dailyWithdrawalLimit){}
void deposit(double amount) override {
Client::deposit(amount);
// Update transaction history
}
void withdraw(double amount) override {
if (amount > dailyWithdrawalLimit){
cout << "Exceeded daily withdrawal limit."<< endl;
} else {
Client::withdraw(amount);
// Update transaction history
}
}
void transfer(Client& recipient, double amount) override {
if (recipient.id == id){
cout << "Cannot transfer to the same account." << endl;
} else {
Client::transfer(recipient, amount);
}
}
void requestLoan(double amount){
// Implement loan request mechanism
}
};
// Derived class for Company Clients
class CompanyClient : public Client {
private:
string companyName;
string taxNumber;
double dailyWithdrawalLimit;
public:
CompanyClient(string companyName, string address, string taxNumber, string id, string password, double dailyWithdrawalLimit)
: Client(companyName, address, "N/A", id, password), companyName(companyName), taxNumber(taxNumber), dailyWithdrawalLimit(dailyWithdrawalLimit){}
void deposit(double amount) override {
Client::deposit(amount);
// Update transaction history
}
void withdraw(double amount) override {
if (amount > dailyWithdrawalLimit){
cout << "Exceeded daily withdrawal limit."<< endl;
} else {
Client::withdraw(amount);
// Update transaction history
}
}
void transfer(Client& recipient, double amount) override {
if (recipient.id == id){
cout << "Cannot transfer to the same account." << endl;
} else {
Client::transfer(recipient, amount);
}
}
void requestLoan(double amount){
// Implement loan request mechanism
}
};
// Class for Banking Employees
class BankingEmployee {
private:
string id;
string password;
public:
BankingEmployee(string id, string password)
: id(id), password(password){}
void viewAllAccounts(){
// Read and display all client accounts from files
cout << "Viewing all accounts" << endl;
}
void approveAccount(Client& client){
// Implement account approval mechanism
cout << "Account approved" << endl;
}
void rejectAccount(Client& client){
// Implement account rejection mechanism
cout << "Account rejected" << endl;
}
void approveLoanRequest(CompanyClient& company){
// Implement loan approval mechanism
cout << "Loan request approved" << endl;
}
void rejectLoanRequest(CompanyClient& company){
// Implement loan rejection mechanism

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions