Q2. Write a class Bank that has the following data members –Account Holder name (ah_name[]) –Account number (ac_number) •Must unique, system generates automatically, and must starting from 100 (Hints: Use another static variable and assign that variable to ac_number) –Balance in the account (ac_balance) •The class has the following member functions –A constructor to initialize the data members –Input() to takes name from the user –Deposit(parameter) to deposits balance in the account •Must accept parameter (The amount to deposit) –Withdraw(parameter) to withdraws balance after checking •Must accept parameter (The amount to withdraw) –Display() to show the name, account number, and balance
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Q2. Write a class Bank that has the following data members
–Account Holder name (ah_name[])
–Account number (ac_number)
•Must unique, system generates automatically, and must starting from 100 (Hints: Use another static variable and assign that variable to ac_number)
–Balance in the account (ac_balance)
•The class has the following member functions
–A constructor to initialize the data members
–Input() to takes name from the user
–Deposit(parameter) to deposits balance in the account
•Must accept parameter (The amount to deposit)
–Withdraw(parameter) to withdraws balance after checking
•Must accept parameter (The amount to withdraw)
–Display() to show the name, account number, and balance
Step by step
Solved in 4 steps with 2 images