Answer to Question #268946 in C++ for hamza

Question #268946

HBL Bank requires account management software. The branch manager met with the software engineers and discussed the details/requirements. According to him, the bank needs to store account title (name), account number, account type and balance for each account entry. You can deposit and withdraw amount. You are required to provide a library that can be utilized in the management system. Analyze the problem, and implement (interface and definitions) using C++ classes. Comment the header file (the interface) so that a manager can understand the functionalities of every public member function. Class should contain a display function to print all information of an account on screen. Create a demo main program to check each and every function. Also create setter/getter and a parameterized constructor with default arguments.


1
Expert's answer
2021-11-19T17:07:03-0500
#include <iostream>


using namespace std;


class Bank{
    private:
        string name;
        int account_number;
        string account_type;
        double balance;
    public:
        Bank(string n, int no, string type, double b){
            name=n;
            account_number=no;
            account_type=type;
            balance=b;
        }
        void deposit(double amount){
            balance=balance+amount;
        }
        void withdraw(double amount){
            balance=balance-amount;
        }
        void display(){
            cout<<"\nName: "<<name;
            cout<<"\nAccount number: "<<account_number;
            cout<<"\nAccount type: "<<account_type;
            cout<<"\nBalance: "<<balance;
        }
};


int main()
{
    Bank b ("ABC",1234,"XYZ",0.0);
    b.display();
    b.deposit(7800);
    b.display();
    b.withdraw(4500);
    b.display();


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS