Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions