$30
COP 2510
Homework #1
Title: The New ACME Machines ATM Machine
Bank of America has decided to replace their old, COBOL programmed, ATM machines. ACME Machines,
your employer, has won the contract to create and deliver the 500 new ATM machines that Bank of
America is going to need. At the lead programmer for ACME Machines, it is going to be your
responsibility to create the software that the new ATM machine will use.
Bank of America has provided an overview of how their customers typically interact with an ATM
machine. The bank customer enters their card into the machine and then types in their PIN. Bank
security then verifies the card. The user selects the account to use (e.g. checking or savings). They then
select an amount to withdrawal. Security verifies if the amount is available. The system then makes a
decision as to if it is going to provide the money. The ATM provides the funds if possible. The ATM
provides a receipt and returns the card to the user.
The Java program that you will create to control this ATM machine will start with a main method;
however, then control will be transferred to a series of classes. Your program will contain at least the
following classes and methods:
Class: ATMCard
o (1) Variable: cardNum – holds a single ATM card's ID number
o (1) Variable: cardPIN – holds a single ATM card's PIN number
o (1) Variable: checking balance – amount of money in this person's checking account
o (1) Variable: savings balance – amount of money in this person's savings account
Class: CardServices
o (2) Method: initializeCardDB – creates an array containing ATM card numbers and PINs
o (3) Method: insertCard – checks to see if the inserted card's ID number is recognized
o (6) Method: processCard – allows a user to request funds to withdraw
o (12) Method: returnCard - returns the inserted card to the user
Class: PIN
o (4) Method: processPIN – compares the entered PIN to the PIN stored for this card
o (5) Method: eatCard – if the PIN is incorrectly entered four times, this eats the card
o
Class: Security
o (9) Method: verityBalance – ensure that the card owner's account has enough money
o (10) Method: verifyMachineBalance -- ensure that the ATM machine has enough money
Class: Account
o (7) Method: select – determines if the user wants to withdraw from checking or savings
Class: Money
o (8) Method: enterAmount – asks user to enter the amount that they want to withdraw
Class: Dispense
o (11) Method: ones – dispenses ones
o (11) Method fives – dispenses fives
o (11) Method: tens – dispenses tens
o (11) Method: twenty's – dispenses twenty's
You can assume that the ATM has been loaded with $1,000 in the following denominations: 25 $20 bills,
25 $10 bills, 40 $5 bills, and 50 $1 bills. The ATM machine will attempt to provide every customer with
money using the largest available bills assuming that the machine still has enough money to fulfill the
request – denominations don't matter (i.e. it could use all $1 if that's all that it had left)
The ATM machine should be programmed to display "Wrong PIN", "Unrecognized card", and "Out of
money – cannot complete transaction". The machine should "eat" the ATM card if the PIN is entered
incorrectly 4 times.
The machine will be preloaded to recognize the following ATM cards:
Note that "-1" means that an account does not exist.
Once you've created your ATM machine, simulate the following transactions:
1. John Smith has both a checking and a savings account with BoA. He uses the ATM with card
123456789 and enters PIN 1111. He then requests $250 from his checking account.
2. Amy Rain has accounts at Citi Bank. When he inserts his ATM card into the BoA ATM machine
with card ID number 347821905 the ATM machine should reject it.
3. Paul Logan has both a checking and a savings account with BoA. He uses the ATM with card
675849302 and enters PIN 0071. He then requests $500 from his checking account.
4. Tammy Placard only has a checking account. She then uses the ATM with card 135792468, but
can't remember her PIN. She tries 2000, 2090, 2077, and 2079.
5. Jill Holland only has a checking account with BoA. She uses the ATM with card 019283746 and
enters PIN 6194. She then requests $300 from her checking account. This amount is refused
because the machine does not have that much money. She then requests $250 and the machine
completes the transaction.
Note: You are only permitted to use the Java commands that we have covered in class so far. Yes, there
are many more, but no, you can't use them in solving this homework!
→ Homework Assignment: Submit an electronic copy of your program
via the Canvas tool.
Card Number PIN Checking Savings
123456789 1111 $550 $1,275
135792468 2097 $90 -1
019283746 6194 $715 -1
675849302 0071 $790 $211
347821904 9871 $113 $78
Assignment Requirements:
1. You are required to submit an electronic copy of your program online via the Canvas tool.
2. Javadoc comments should be included for each class, method, and parameter. Before each
method, put the following comment lines:
/**
* Method Name: xxx
* Description: xxx
*
* @param xxx
*/
3. Your code must contain the following comment header:
//
// COP 2510 – Spring Semester, 2020
//
// Homework #1: The New ACME Machines ATM Machine
//
// (Your Name)
//
4. This homework is due at the start of class on Thursday, 02/13/2016.