1. Create the class BankAccount. Objects created from this class will simulate bank accounts, allowing us to have a starting balance, make deposits, make withdrawals, and get the current balance. The only instance variable of the class is a double balance.

2. It has 3 overloaded constructors. (1) The default constructor, (2) BankAccout(double startBalance) (3) BankAccount(String startBalance)

3. it has two overloaded deposit methods: (1) deposit(double amount) (2) deposit(String str) They are of type void

4. It has two overloaded withdraw methods: (1) withdraw(double amount) (2) withdraw(String str) Both are void type

5. overloaded setBalance methods: (1) setBalance(double b) (2) setBalance(String str); both are of type void

6. getBalance() returns a bouble for balance

7. Write a toString method

Write a Test class to test the BankAccount.

In the main method, create a BankAccount object using the default constructor, Deposit money using both the String input and the double input to test the overloaded methods. Then display the bank balance.

Next withdraw some amount once using the double amount, and using the String amount. Then display the bank balance.

To test the overloaded constructors, create two more BankAccount objects. Display the account balance. Deposit money and withdraw money. Then display the balance after every transaction.

Note: (1) You must always check if there is enough money before withdrawing. If the balance is 0, no money can be withdrawn. This should be incorporated in both the withdraw methods.

(2) When you enter balance amounts as string, you need to use Double.parseDouble(str) to convert String to double.

2. Now design a savings account class that stores a savings account's annual interest rate and balance. The class constructor should accept the amount of savings account's starting balance. The class should also have methods for subtracting the amount of a withdrawal, adding the amount of a deposit, and adding the amount of monthly interest to the balance. The monthly interest rate is the annual interest rate divided by twelve. To add the monthly interest rate to the balance, multiply the monthly interest rate by the balance, and add the result to the balance.

test the class in a program that calculates the balance of a savings account at the end of a period of a time (6 months for example). It should ask the user for the annual interest rate, the starting balance, and the number of months that have passed since the account was established. A loop should then iterate once every month, performing the following:

(a) Ask the user for the amount deposited into the account during the month. Use the class method to add this amount to the account balance.

(b) Ask the user for the amount withdrawn from the account during the month. Use the class method t subtract this amount from the account balance.

(c) Use the class method to calculate the monthly interest.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.