A Real world Problem:
This is a business rule of a bank that the Balance of customer must always be Positive,
Further that it is also a business rule that a customer can not withdraw amount greater than his/her current balance.
You are required to write a C++ program to solve this real world problem, using Exception Handling.
Your program should consist of a class Customer and 4 instance variables. Cust_name, Cust_AC_No, Cust_balance, Amount_withdraw.
Cust_name : Customer Name
Cust_AC_No : Customer Account Number
Cust_balance : Customer Balance
Amount_withdraw : Amount that is to be withdraw
The class should further consists of getter and setter function for each instance variable.
The setter function of Cust_balance consists of a try and a catch block, if the user enters the balance less than zero (means negative, which is not possible) then this function should throw an exception, and its corresponding catch block should handle this exception by providing another opportunity to the user to enter the balance again.
Similarly the setter of Amount_withdraw variable should also have a try and a catch blocks. If the user enters the withdraw amount greater than the current balance then this function should throw an exception, and its corresponding catch block should handle this exception.
In main function just declare an object of Customer class and call all its setter and getter functions
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!