In this lab you will implement a simple database. To do so, you will use most of what you have learned throughout this course. You will begin by creating a list of objects by reading the information for each object from a disk file. (Alternatively, you can have the user enter all of the information through the GUI, but the user must be able to save this information to disk so that it can be loaded the next time the program is run.) Then your program will manipulate those objects in response to user inputs from a GUI you have built.
This program will be large enough that you may become very confused if you do not design your program well, or if you attempt to implement too much at once. Therefore, start small, and practice stepwise implementation; this requires discipline on your part, there is a great temptation to jump right in before thinking a problem through.
In doing this program you will also be fulfilling the English based Writing Centered portion of the class. There are two parts of this. First you must complete and hand in a design for your program; A first draft is due in class on Thursday April 17. The finished design is due the following Tuesday, April 22. Second, you must complete a retrospective essay discussing the process of designing, writing, and debugging your program. Both the design and the essay are described in more detail in links below.
You are to turn in the following items:
You may choose either of two different database labs, or, if you wish, you may propose your own.
Common requirements
Whichever choice you make, the following are required.
Every major bank supports ATM machines. These are basically small database clients equipped with a card reader, money dispenser, deposit slot, keyboard and screen. In an early lab, you simulated an ATM; for this lab you will simulate a bank which can be accessed through such an ATM.
A bank has a number of customers. Each customer may have a checking account, or a savings account, or both. There are two types of accounts, checking and saving. Each account has a name, a personal identification number (PIN), an account number, and a balance. Both may be accessed from ATM machines.
Simulate a seeded, single elimination tennis tournament (or basketball, or soccer, or Doom, or whatever). Banks always need programmers, but the work is, in my opinion, a trifle dull (although, surely some people enjoy it). Tournaments also sometimes employ programmers, though they typically don’t have as much money. You have more latitude in a tournament simulation than in the bank simulation; and it may be more fun and creative, but it may require more thinking. This will be written as if the subject is a tennis tournament; if you choose some other contest, adapt this to the area you choose.
Each player has a name, a ranking (i.e. their rank among all players), and two integer ability ratings: service and skill (these will be explained below). A tournament starts with all the players in a bracket by their seeds (as described in class). Each pair of players plays a match, and the winner advances to the next round. When a player loses a match they are out.
The winner of a match is the first player to win 3 sets. The winner of a set is the first to win 6 games and be at least 2 games ahead. The winner of a game (as you likely know) is the first to win 4 points and be ahead by at least 2.
int random = (int) (Math.random() * 100); // get a number >=0, <100
boolean itHappens = random < 70; // 70 times out of 100
if (itHappens)
doOneThing();
else doAnother();
Perhaps you would prefer to write a database program for some other area. For instance, perhaps you are interested in molecular biology and wish to build a catalog of human (or drosophila) genes and their interactions. Or perhaps you’d like to build a computer dating service. Or maybe you’d like to build an order taking and inventory system for an e-business. The possibilities are many.
If you’d like to design your own database program, then write up a proposal and I’d be happy to consider it. But, do it soon, it’s not long until May 6!
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.
[top]