Adam Cap

  • About
  • Mail
  • Archive/Search

AP Java Programming Project: ATM Machine

↘︎ May 30, 2006 … 1′ … download⇠ | skip ⇢

For my end of the year project, I chose to design and program a virtual ATM machine. The program uses the Account class from Chapter 4, the Lockable interface from Chapter 5, IStream, and the ATM_Machine class, which is the main part of the program. ATM_Machine first stores an array of Account objects. These objects are used to represent different peoples’ bank accounts. Each Account object is passed a person’s name, their account number, their current balance, and their password.

The program then asks for your account number. Because there is no way for me to implement an actual debit card and scanner, you have to type out your account number yourself. For example, type “55554” for the account number when prompted. Next the program checks to see if you inputted a valid account number with the method, boolean isValidAccountNumber(int accountNumber). It is passed in the account number you entered. It then checks through the array of accounts to see if the number you entered matches up with any of the accounts. If it does, the boolean will be true. If not, it will be false and ask you to try again. “55554” is not a valid account number, so now try “55555” so you can move on. The method saves a placeholder for the index of the Account object that you are accessing, so you can use it later in the program.

Next it will ask for your password. For example, type “5554”. The program then will check to see if the password is correct using the method isValidPassword(int password). This method checks to make sure the password entered matches up with the password passed in as the parameter of the Account object. If it is correct, the boolean becomes true and you can pass forward in the program, if incorrect, the boolean will be false and you will have to try again. Now type “5555”, which is the correct password.

Once the correct account number and password combination is entered, the methods in Account will now unlock. Lockable is in place to make sure there is no way you can bypass the code to access an account. You must enter the right account number and password for the methods to unlock so that they are accessible. This would be similar to the security in a real ATM machine, in that you can’t access someone’s account unless they are logged in.

Next you will be prompted to either select check your balance, withdraw, deposit, or quick cash (which is set to automatically withdraw $20). If you select “Check Balance”, it will simply show your current balance. If you select “Withdraw”, you will be prompted to enter how much money you would like to withdraw. If you select “Deposit”, the program will ask how much money you would like to deposit. Finally, if you select “Quick Cash”, it will automatically withdraw $20 from your account. Once you complete your selection, it will print a virtual receipt, then log you out by locking Account.

Me

circa 2009 (21 y/o)

about adam

Recently…

  • 10 May 25: An Art Critique on “Tennis Court” by Ellsworth Kelly (1949) #ART 1021 (Introduction to Art History & Appreciation II) #Dr. Emily Hage #Saint Joseph’s University
  • 10 Apr 22: Oxygenation and Hydrochlorination of Vaska’s Complex Ir(Cl)[P(C6H5)3]2(CO) #CHM 2521 (Inorganic Chemistry Lab) #Dr. Peter M. Graham #Saint Joseph’s University
  • 10 Apr 21: Refraction Lab #Dr. Paul J. Angiolillo #PHY 1042 (General Physics Lab II) #Saint Joseph’s University
  • 10 Apr 20: The Mental, Physical, and Social Implications of Self Enhancement #Dr. Judith J. Chapman #PSY 2341 (Psychology of the Self) #Saint Joseph’s University
  • 10 Apr 18: Law of Reflection Lab #Dr. Paul J. Angiolillo #PHY 1042 (General Physics Lab II) #Saint Joseph’s University
  • 10 Apr 16: Synthesis, Determination, and Catalytic Measurement of Ruthenium Indenylidene Complexes used in Olefin Metathesis #CHM 2521 (Inorganic Chemistry Lab) #Dr. Peter M. Graham #Saint Joseph’s University
  • 10 Apr 12: Current Balance Lab #Dr. Paul J. Angiolillo #PHY 1042 (General Physics Lab II) #Saint Joseph’s University
  • 10 Apr 10: The Perfect Paper #Mr. Robert Fleeger #PHL 2011 (Knowledge and Existence) #Saint Joseph’s University
  • 10 Mar 29: Magnetic Fields Lab #Dr. Paul J. Angiolillo #PHY 1042 (General Physics Lab II) #Saint Joseph’s University
  • 10 Mar 22: Series and Parallel Circuits Lab #Dr. Paul J. Angiolillo #PHY 1042 (General Physics Lab II) #Saint Joseph’s University
  • 10 Mar 17: Synthesis and Determination of [1,3,5-C6H3(CH3)3]Mo(CO)3 #CHM 2521 (Inorganic Chemistry Lab) #Dr. Peter M. Graham #Saint Joseph’s University
  • 10 Mar 4: Synthesis and Determination of Polypyrazolylborates #CHM 2521 (Inorganic Chemistry Lab) #Dr. Peter M. Graham #Saint Joseph’s University
  • 10 Mar 2: Electrical Resistance and Ohm’s Law #Dr. Paul J. Angiolillo #PHY 1042 (General Physics Lab II) #Saint Joseph’s University
  • 10 Feb 22: Hooke’s Law and Simple Harmonic Motion #Dr. Paul J. Angiolillo #PHY 1042 (General Physics Lab II) #Saint Joseph’s University
  • 10 Feb 11: Tinkering with Tin #CHM 2521 (Inorganic Chemistry Lab) #Dr. Peter M. Graham #Saint Joseph’s University
  • 10 Jan 21: Psychology of the Self Notes #Dr. Judith J. Chapman #PSY 2341 (Psychology of the Self) #Saint Joseph’s University
  • 09 Dec 7: The Biochemistry of Anthrax #CHM 2611 (Biochemistry) #Dr. Mark F. Reynolds #Saint Joseph’s University
  • 09 Dec 5: Ring-Opening Metathesis PowerPoint Presentation #CHM 2511 (Inorganic Chemistry) #Dr. Peter M. Graham #Saint Joseph’s University
  • 09 Nov 22: Double Group Transfer Reactions of an Unsaturated Tantalum Methylidene Complex with Pyridine N-Oxides #CHM 2511 (Inorganic Chemistry) #Dr. Peter M. Graham #Saint Joseph’s University
  • 09 Nov 21: Conservation of Angular Momentum #Dr. Paul J. Angiolillo #PHY 1032 (General Physics Lab I) #Saint Joseph’s University
archive

More from…
12th Grade – AP Computer Science (Class) / Dr. Paul Burgmayer (Teacher) / Great Valley High School (School) / schoolwork (Post Type)

⇠ Previous
Next schoolwork ⇢
  • Home
  • About
  • Archive
  • Mail
  • Random
  • Dingus
  • Reading
  • Code

ADAM CAP is an elastic waistband enthusiast, hammock admirer, and rare dingus collector hailing from Berwyn, Pennsylvania.

My main interests at this time include reading, walking, and learning how to do everything faster.

Psst: If you find my website helpful or enjoyable, please join my newsletter and/or send me an email—I want to hear from you!

Disclosure: As an Amazon Associate I earn from qualifying purchases.

© 2009–2023 Adam Cap(riola) top ⇡