Last Lab 8, A Simpler Database -- Due 12/11/8
This lab is for people in danger of failing the course. It is a simpler version of the regular lab.
It is easier to do, but the best grade you can get in the course if you do this one is a C.
Introduction
Every major bank supports ATM machines. These are basically small database
clients equipped with a card reader, money dispenser, deposit slot, keyboard
and screen. For this lab you will
simulate a bank which can be accessed through such an ATM.
Only allow two actions, withdrawals and displaying the balance.
Please reread
Chapter 3 if you
have any questions about how to make an ATM and/or simulated Bank.
Your task
Write a program that will manage any number of bank accounts. Each account will have a name and a balance (use int for simplicity).
Allow users to display their current balances and withdraw as much (simulated) money as they
want with a graphical user interface (GUI).
- Store your database in memory in an ArrayList.
- Organize your program so that the GUI Frame contains only user interface code. That is,
put all the database handling code in your own classes.
- When the program starts, read the contents of the database from a file into memory.
- Display all the users in a Choice; to select an Account for withdrawals or to check the balance select an account from the Choice
- Database manipulation; Allow the user to:
- display the entire database in a TextArea.
- add or delete a record
Problem solving advice
There are many different problem solving strategies that people
employ when programming. Here, problem solving is the behavior that
one engages in when one does not know how to proceed.
Some of the
most common debugging strategies are:
-
Ask an expert
This method can be very effective, but as your programming
expertise grows, it is less and less effective. As
programmers become proficient, fewer and fewer things actually
stop them, and even when they are frankly confused, they do not
give up. Clearly there are times when the right thing to do is
ask for help, but learning self-reliance and confidence is preferable
to remaining dependant and helpless without the expert.
-
Try to find the problem yourself.
- Attempt to analyze the code -- by staring at it and thinking.
- Insert output statements -- to discover the values of variables.
- Use the debugger -- as above but an order of magnitude faster.
- Do an experiment -- to figure out what's happening.
Demo your lab for credit