Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/********************************************************** * Program Name : * Author : * Date : * Course/Section : * Program Description: This program will keep track of the balance

/********************************************************** * Program Name : * Author : * Date : * Course/Section : * Program Description: This program will keep track of the balance and * transaction history for a simple savings account. * * Methods: * ------- * Main - calculates the average of 2 quiz grades * **********************************************************/ public class TrackBankTransactions { /********************************************************** * Method Name : main * Author : * Date : * Course/Section : * Program Description: This program will keep track of the balance and * transaction history for a simple savings account. The program will * first input an initial balance. It will then allow the user to input * up to 20 transactions. Each transaction will be either a deposit * or a withdrawal. The balance will be updated accordingly with each * transaction being stored in an array of transactions. The forat of * each transaction will be a string that starts with either "w" or "d" * followed by the amount of the transaction. Each transaction amount * must include both dollars and cents. 2 types of errors can occur. * The transaction type is invalid or the user tries to withdraw more * money than is in the account. Display an error message if either of * these situations occur. Use a sentinel value to stop entering in * transactions. When the user enteres the sentinel value the program * will display the transaction history and the final balance. * * Transaction Type example: "d34.76" or "w3.00" * * BEGIN Calc Average * Initialize array count to 0 * Input the initial balance * Input the first transaction (or sentinel) * WHLE (the transaction is not the sentinel value) * Get transaction type from the transaction that was entered * IF (transaction type is invalid) * Display error message * Input next transaction * ELSE * Convert transaction amount to float * IF (the user tries to withdraw too much money) * Display error message * ELSE * IF (the transaction type is Deposit) * Add the transaction amount to the balance * ELE * Subtract the transaction amount from the balance * ENDIF * Add balance to end of transaction, store in the array * Add 1 to Array Count * IF (the array is full) * Set transaction to sentinel value to exit loop * ELSE * Input next transaction (or sentinel) * END IF * END IF * END WHILE * Display Transaction report heading * FOR (each transaction in the transaction array) * Display the transaction type, transaction amount, and new balance * END FOR * END Calc Average **********************************************************/ public static void main (String [] args) { //local constants //local variables /******************** Start main method *****************/ } //end main method } //end Template264 

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

Step: 3

blur-text-image

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions