Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you are required to develop a program that simulates an advanced Automated Teller Machine (ATM). The reason that this machine is an

In this assignment you are required to develop a program that simulates an advanced Automated Teller Machine (ATM). The reason that this machine is an advanced machine is because it does more than just deposits, withdrawals, and balance inquiries.

The additional functionality of this machine contains user control over the date on which the transaction occurred. It also has the ability to list transactions on a specific date.

The program goes as follows:

a) You will start out by asking the user about the maximum number of transactions (This is an integer number). Once the number is entered the program starts with a balance of $0.00.

b) You will display the following menu:

Enter your Transaction: 1. Deposit. 2. Withdrawal. 3. Balance Inquiry. 4. Display the largest change in balance (positive or negative) and the date on which it occurred. 5. Display All Transactions 6. Display All Transactions on a specific date. 7. Exit. Choice:

1. When the user enters a 1, the system should ask the user to input a real number representing the deposit (in dollars and cents in the format of x.y where x are the dollars and y are the cents). Once that is done, the system will ask the user for a date of the format MMDD to be considered as the date of the transaction. The format MMDD may also be MDD in the case of single digit months. Once both amount and date are entered, then the system will update the balance accordingly, as well as record the transaction as a deposit as well as record the date for that same transaction. Do not enter the year because it is assumed to be 2021. They system should check to see if the deposit amount entered is a real number greater than zero. Also, the system should check to see if the date is a valid date, otherwise the transaction shouldn't be recorded. Examples of invalid dates include 230 (February 29th, and 30th), or 1790 (the 90th day of the 17th month of the year). Then the system should redisplay the menu.

2. When the user enters a 2, the system should ask the user to input a real number representing the withdrawal (in dollars and cents in the format of x.y where x are the dollars and y are the cents). Once that is done, the system will ask the user for a date of the format MMDD to be considered as the date of the transaction. The format MMDD may also be MDD in the case of single digit months. Once both amount and date are entered, then the system will update the balance accordingly, as well as record the transaction as a withdrawal as well as record the date for that same transaction. Do not enter the year because it is assumed to be 2021. You'll need to print a warning message if the user is trying to withdraw money and the balance is $0.0, even before the user inputs the amount to withdraw. Also, you'll need to display an error message if the user is trying to withdraw an amount larger than what's in the balance. Also, here you'll need to validate the amount(>= 0.0) as well as the date. Then the system should redisplay the menu.

3. When the user enters a 3, the system will ask the user for a date of the format MMDD to be considered as the date of the transaction. The format MMDD may also be MDD in the case of single digit months. Once the date are entered, record the transaction as a balance inquiry as well as record the date for that same transaction. Do not enter the year because it is assumed to be 2021. Also, here you'll need to validate the date. Then the system should redisplay the menu.

4. When the user enters a 4, the system will ask the user for a date of the format MMDD to be considered as the date of the transaction. The format MMDD may also be MDD in the case of single digit months. Once the date are entered, record the transaction as a largest change as well as record the date for that same transaction. Do not enter the year because it is assumed to be 2021. Then the program should display the date and amount of the largest change in balance, not the largest deposit or withdrawal because you could have multiple deposits and multiple withdrawals on a specific date, therefore, you need to look at what the balance was before the first transaction on that date and what it was after the last transaction on the same date. The program should display the amount of change either positive or negative. Then the system should redisplay the menu. 5. When the user enters a 4. The user is asking to print all the transactions that occurred so far, as a result one of the following will happen.

a. A message saying that sorry but there are no transactions on the date specified. This message should only be displayed if and only if there are no transactions on the date specified.

OR

b. A Listing of all the transactions as a neatly designed and annotated table of the following format:

Date Transaction Amount ========== =========== ======== 06/21/2021 Deposit $ 120.78 02/04/2021 Withdrawal $ 10.23 ... ... ... 03/22/2021 largest change $ -20.45 01/11/2021 Balance Inquiry -------- 04/30/2021 Withdrawal $ 0.21

Then the system should redisplay the menu.

6. Repeat No. 5, except you must specify a date as input. Once the date is specified, then you just display all the transactions that happened on that date in the same format as No. 5. If there are no transactions on that date, then display a message indicating that. Then the system should redisplay the menu.

7. When the user enters a 7, then the system should exit.

8. If the user enters a number less than 1 or larger than 7, then an error message should be displayed indicating that an illegal choice was entered, try again. c. Your program should be able to handle any number of transactions in total (deposits, withdrawals, balance inquiries, and largest change). Also, when you print an error or a warning (e.g. illegal date), you need to print 5 stars ***** before the error and do not tab the error message making the 5 start the first thing on the line.

d. IN THIS ASSIGNMENT, YOU ARE NOT TO SORT ANY DATA IN ANY WAY. Transactions should always be store and displayed in the order in which they occur. ----- Implementation requirements:

1. YOU MUST IMPLEMENT A CLASS CALLED ATM THAT HAS ALL THE FUNCTIONALITY GIVEN ABOVE. You will need to implement this assignment using 2 different files: ATM.java, ATM_Driver.java. ATM.java will contain the class ATM and the the methods that it implements (1-6 above). The driver program, should continue to display the menu, perform the selected operations and only exit when the number 7 is pushed. Feel free to implement additional classes that could very well be appropriate for this assignment, this will add additional class files to be used and that's OK. The logic to perform all of the operations 1-6 should be contained in the ATM class, the driver program should handle the IO and only calling the methods in the ATM class.

HINT: A Transaction class may be needed.

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions