I need to find a way to get a static method called


I need to find a way to get a static method called balanceCheckbook that takes a console Scanner as a parameter and that prompts a user for information about transactions for a bank account, reporting the new balance after each transaction and the minimum balance at the end and returning whether or not the account was ever overdrawn (true if it was, false if it was not). The user needs to be prompted for an initial balance, the number of transactions to process, and the individual transaction amounts. Deposits to the account are entered as positive numbers and checks and ATM withdrawals are entered as negative numbers. A new balance is reported

after each transaction. For example, the method would be called as follows:

Scanner console = new Scanner(System.in);

balanceCheckbook(console);

Below are two sample logs of execution that might be produced:

initial balance? 48.50                          initial balance? 39.75

how many transactions? 4                  how many transactions? 5

1/4 amount? -20.00                            1/5 amount? -18.50

new balance = $28.5                          new balance = $21.25

2/4 amount? -5.75                              2/5 amount? -7.20

new balance = $22.75                        new balance = $14.05

3/4 amount? 138.20                            3/5 amount? -23.10

new balance = $160.95                       new balance = $-9.05

4/4 amount? -20.00                             4/5 amount? 50.00

new balance = $140.95                       new balance = $40.95

minimum balance = $22.75                5/5 amount? -8.45

new balance = $32.5                            minimum balance = $-9.05

In the log to the left, the user enters 4 different transactions and the minimum balance is not negative, so the method would return false to indicate that the account was never overdrawn. In the log to the right, the user enters 5 transactions and the minimum balance is negative, so the method would return true to indicate that the account was overdrawn. You are to exactly reproduce the format of these logs. You may assume that the number of transactions entered by the user is at least 1.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: I need to find a way to get a static method called
Reference No:- TGS02694495

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)