Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bank Account Java Programming 5294360001 - account number 7848 - pin number John Smith - account name 100.00 - amount Account User Program Assume a

Bank Account Java Programming

image text in transcribed

5294360001 - account number

7848 - pin number

John Smith - account name

100.00 - amount

Account User Program Assume a program already exists which takes user input to create an account and store it in a file. Display the following menu for the user to choose. Select one of the following operations: 1. Get account balance 2. Make a deposit 3. Make a withdrawal 4. Exit the system The program should contain a function which shows this menu to the user, gets input from user and determines whether or no the input in valid. If it is not, output an error message and repeat the menu until valid input is entered. This function returns the valid input. It should sharea Scanner with the main method that calls the function, so a Scanner is needed as a parameter. Use nextLine to get rid of any unprocessed end of line characters. Necessary functions: getBalance: parameters are account number and pin. This function is used to print balance for accounts that have been validated. * deposit: parameters are account number, pin, and amount .withdraw: parameters are account number, pin, and amount All three of these functions require that the account number and pin be validated before anything else can happen to the account Use a separate function for validation. Validation can fail if the account number is not found, or the pin for the account does not match. If that does occur display error message. The deposit and withdraw functions both have the possibility of changing an existing account balance for accounts that have been validated. Create a separate function to update accounts. The withdraw function does not change the existing account if the amount being withdrawn exceeds the account balance. An appropriate error message is displayed in this case. Read existing accounts and write them to a temporary file. When the account being updated is read, the updated account information is written to the temporary file. Format for account example: 5294360001 7848 John Smith 100.00 May be helpful to use these string functions - split, starts With, and equals Account User Program Assume a program already exists which takes user input to create an account and store it in a file. Display the following menu for the user to choose. Select one of the following operations: 1. Get account balance 2. Make a deposit 3. Make a withdrawal 4. Exit the system The program should contain a function which shows this menu to the user, gets input from user and determines whether or no the input in valid. If it is not, output an error message and repeat the menu until valid input is entered. This function returns the valid input. It should sharea Scanner with the main method that calls the function, so a Scanner is needed as a parameter. Use nextLine to get rid of any unprocessed end of line characters. Necessary functions: getBalance: parameters are account number and pin. This function is used to print balance for accounts that have been validated. * deposit: parameters are account number, pin, and amount .withdraw: parameters are account number, pin, and amount All three of these functions require that the account number and pin be validated before anything else can happen to the account Use a separate function for validation. Validation can fail if the account number is not found, or the pin for the account does not match. If that does occur display error message. The deposit and withdraw functions both have the possibility of changing an existing account balance for accounts that have been validated. Create a separate function to update accounts. The withdraw function does not change the existing account if the amount being withdrawn exceeds the account balance. An appropriate error message is displayed in this case. Read existing accounts and write them to a temporary file. When the account being updated is read, the updated account information is written to the temporary file. Format for account example: 5294360001 7848 John Smith 100.00 May be helpful to use these string functions - split, starts With, and equals

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions