Question
Using Java Create an BankAccount Class that has an account id number (of type integer), balance (of type double), and rate (of type double) as
Using Java
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. Add get and set methods for these three variables to work with these attributes. Make overloaded constructors to bring in and set all values, and also to just to bring in a customer name and id which uses 0 for the balance. Include error handling in the set for the balance which throws an exception if a change would put the balance below 0. In Main of another class file create 2-3 objects of BankAccount and work with their values and output them to the user to test your new class.
Create a BankCustomer class with 3 BankAccount objects inside it as private variables (of type BankAccount) as well as a customer name (of type String). [The three accounts are for checking, savings, and money market.] Add get and set methods for these three variables to work with these attributes. The constructors you make are up to you on this class. In Main of another class file create two BankCustomers, with their names and all account information and the values in them for the user. Then add 1000 to the checking account of the first one and 500 to the savings account of the second one and print all account information and the values in them for the user to test your new class and working with its internal objects through the outer 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