Question
Create an BankAccount Class that has an account id number (of type integer), balance (of type double), and rate (of type double) as private data.
Create an BankAccount Class that has an account id number (of type integer), balance (of type double), and rate (of type double) as private data. Define three overloaded constructors, one full constructor which brings in parameters to set all attrributes, one partial constructor which brings in one p[arameter to set account id and uses 0 for the balance and rate, and a non-arg constructor which uses default value for each attribute. Make sure to include error handlings, either selection or try/catch, to make sure the balance and rate are not negative.Add get and set methods for these three variables to work with these attributes. Create a deposit method and a withdraw method for user to deposit or withdraw user specified amount to or from the BankAccount.
In main method defined in another class file BankAccountTest, create 2-3 objects of BankAccount and work with their values and output them to the user to test your new class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started