Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to implement an Automatic Teller Machine (ATM) for a small bank. Each day, the machine is started up by the banks IT support.

You are to implement an Automatic Teller Machine (ATM) for a small bank. Each day, the machine is started up by the banks IT support. At this time, the ATM reads a list of current accounts, Personal Id Numbers (PINs), and account balances from a file.

Once started, customers use the ATM to make deposits, withdrawals and balance inquiries. For each customer, the ATM asks for and validates the account number and PIN

number, then performs the deposit/withdrawal/balance-inquiry for the customer. For each successful withdrawal and deposit, the ATM maintains a list of transactions, including

account number and amount for each, and updates the accounts current balance. The ATM is limited to a maximum number of total withdrawal/deposit transactions it can process per day, and will refuse to do deposits and withdrawals once this limit is surpassed.

At the end of the day, IT support enters a secret account number and PIN (10000 and 1000). Once entered, the ATM shuts down, writing the list of transactions to a file. About the

data: - Account Numbers are length 12 or less, made up of any characters, but no white space. - PINs are integers of four digits. - Balances are assumed to not exceed $ 99999.99

Detailed Description: Start Up: - The logo is displayed, and a startup message printed. - The account file is read in. When there is an error reading the file, an error message is

printed and the shutdown process (see below) is completed. When there is not an error, a report of the account data read from the file is printed. File format: - File name:

accounts.txt - First Line: the number of accounts - Each following line, one per account: account# pin and balance, separated by a space. - The ATM then proceeds to processing customers.

Processing a Customer: this process is repeated until the shutdown account and PIN are entered. - The logo is displayed. - The user is asked to enter an account number and PIN.

When an invalid account/pin are entered (not on the list read at startup, and not the shutdown code), the ATM reports an error and this process is finished. When a valid

account/pin are entered, the ATM proceeds to the next step. - When the secret shutdown codes are entered, the ATM proceeds to the shutdown process. - When a valid

account/pin is entered: A menu with options Deposit, Withdraw, and Balance Inquiry is presented. The user selects one of the options (D,W,B). The user may enter an entire string

(ie. Withdraw) but the ATM only looks at the first character entered. It also accepts both upper and lower case entries. When an invalid entry is made, an error message is printed

and the menu repeats until the user enters a valid option. - Withdrawal: The customer is asked for a withdrawal amount. When the amount is: o less than 0.00: print Invalid amount!

Enter a value 0.00 or greater o greater than the accounts balance: print Your account only has $ currentBalance o 0: print Transaction canceled and end the process for this

customer o Valid (more than 0 and less/equal the Balance): the account balance is updated a Transaction is added to the ATMs transaction list with account number and

(negative) amount. Prints: Transaction complete. Your new balance is now: $ newCurrentBalance Except: If the maximum number of transactions for the ATM is exceeded,

just print: Transaction cannot be done. Contact IT Support. - Deposit: The customer is asked for a deposit amount. When the amount is:

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

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

how does higher education qualify as a public goods

Answered: 1 week ago