Im having trouble coming up with the java code for this. Can someone help me?
First 3 month month-by-month account balance in your
bank savings account. You need to make one, only one transaction-a deposit or a
withdrawal-each month. Interest is added to the account at the beginning of each month.
You have to create two classes. The first class is the BankAccount class. The class has the
1) Two fields (private)
a) Account Name (for example: John Smith).
b) Account balance (for example: 100.0).
2) A constructor with all fields as parameters.
3) Get Methods - There should be a get method for each of the two fields.
4) Set Methods - There should be a set method for each of the two fields.
5) Other Methods
i) Should add an amount to the balance.
c) If current balance is greater than the amount withdrawal, withdrawal method
should subtract an amount from the balance.
ii) If current balance is smaller than the amount withdrawal, don't subtract the amount
from the balance. Instead, generate an error message "You don't have enough
balance. You cannot make this transaction.".
The second class is a class that includes a main() method. This class should do the following (in
the given order):
Declare the yearly interest rate (yearlylnterestPercent) to be 7.0 and initial bank account
balance (Initial) to be 100.0;
Ask the user for the name of the bank account.
Create a bank account using the name getting from the user and initial bank account balance
(Initial). Print out the account's current balance (for example: (( Jun Yin's current balance is
Create a loop to calculate monthly balance for months 1 to 3. Inside your loop, you should do
Compute the monthly interest monthlylnterestPercent = yearlylnterestPercent/12;
Compute the interest and add to the balance.
Set the current balance to be the new balance you just calculated including the interest.
Ask if the user is making a deposit or withdrawal. (for example: "Would you like to make a
deposit (d) or withdrawal (w)?")
Ask the user what is the amount?
If making a deposit, call deposit method to add the amount to the balance.
Otherwise, call withdrawal method to subtract the amount from the balance.