Please help me with my JS homework.
I have to write a program using the following instructions:
1. Ask the user for their first name
2. Ask the user for their last name
3. Ask the user for an opening balance for their bank account
4. Ask the user to choose an action to perform. This action can be a deposit, a withdrawal, or checking their balance. These choices should be offered to the user in a clear menu-styled prompt message such as “Please enter ‘D’ for Deposit, ‘W’ for withdrawal, or ‘B’ to check your balance”.
5. If the user chooses to make a deposit:
o Ask the user the amount of the deposit
o Check that the amount is more than zero. If it isn’t alert the user of the error and ask them for the amount again (you don’t have to check it a second time, for the purposes of this program we will assume one error message is enough and the user will always get it right the second time).
o Perform the deposit
6. If the user chooses to make a withdrawal:
o Ask the user the amount of the withdrawal
o Check that the amount is more than zero. If it isn’t alert the user of the error and ask them for the amount again (as with deposits, we’ll assume that they will always get it right the second time.
o Once you have the correct amount, check that their balance is greater than or equal to the amount of the withdrawal. If it is perform the withdrawal. If it isn’t alert the user of the error and don’t perform the withdrawal.
7. If the user chooses to check their balance:
o Tell the user their balance.
8. If the user enters an invalid choice for the menu option alert them of the error.
9. For a deposit or withdrawal deduct a 3 cent transaction fee.
10. For all choices (even an invalid entry) accrue 2.25% interest on the account.
11. After you have this menu working, copy and paste it exactly as it is another two times so that the program will offer the user to perform a transaction three times.
12. After the third transaction use document.write() statements to give the user a summary which includes at least the following information:
o A welcome message with the user’s full name
o The opening balance
o A summary of deposits which is “There were no deposits” if there weren’t any deposits,
otherwise the number of deposits and the average amount of each deposit.
o A summary of withdrawals which is “There were no withdrawals” if there weren’t any withdrawals, otherwise the number of withdrawals and the average amount of each withdrawal.
o The closing balance