Question: Write a program to simulate a bank transaction. There are two bank accounts: checking and savings. First, ask for the initial balances of the bank

Write a program to simulate a bank transaction. There are two bank accounts: checking and savings. First, ask for the initial balances of the bank accounts; reject negative balances. Then ask for the account; options are checking and savings. Then ask for the transactions; options are deposit, withdrawal, and transfer. Then ask for the amount; reject transactions that overdraw an account. At the end, print the balances of both accounts. NOTE: Your implementation must include the definition/implementation and use/calling of the following methods: getBalance: method is passed the account name (String) to its parameter variable. It prompts (e.g., "Enter the saving account balance: ") and gets the floating-point account balance as user input. Finally, it returns the user-input balance. getTransaction: method is passed the account name (String) to its parameter variable. It prompts (e.g., "Enter the saving account transaction: ") and gets the transaction String as user input. Finally, it returns the user input as an int: 1 for "deposit", 2 for "withdrawal", 3 for "transfer". getAmount: method is passed the account name (String) and the transaction (int) to its parameter variables. It prompts (e.g., "Enter the withdrawal amount for the checking account: ") and gets the floating-point transaction amount as user input. Finally, it returns the user-input transaction amount. showBalance: method is passed the account name (String) and the (floating-point) account balance to its parameter variables. It outputs the account name as balance (e.g., "The checking account balance: $1,234.56").

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!