Pitstop: Who's in the Pits?

Demo

Premise

You are Fred Smith, the best Pitman ever to grace the Indianapolis 500, hands down! And today is the day of the big race. You have all your wrenches shined, your screwdrivers sharpened, your gauges set and calibrated - hell, you even have clean underwear on. Today, you are manning the pits for everyone! There is only one pitman and you are he! So you need to make sure that you are working on the right car. If you can write the holder class which holds onto a Racecar, then you will help yourself be handy to victory.

Specifications

This laboratory exercise is designed to help you understand the holder pattern. The holder pattern is best described as a pocket that can only have one thing in it at a time. So, when I go to put myhand in the pocket, whatever is the current object is what I get out of this pocket. Unlike a human pocket however, this holder can have its object changed by anyone who has a reference to the holder. So, if your mom said put this piece of bubble gum in the pocket, that is the current object. What you need to do is fill in the two methods in the holder class. To understand how everything is going on in the program, you should read the other classes to understand how everything is working. The TA's running this lab will help answer all questions involved. Then, once you understand the idea, filling out the two methods will be a breeze, and the Pitstop at the Indy 500 will be saved.

Concepts Covered or Why am I doing this?

This lab will help you understand many things (besides the meaning of life and what keeps mayonaise fresh). Such as:

The Support Code

All of the work you will be doing will be in package Pitstop. The classes there are:

These are pretty self explanatory and are well commented. The class you will be focusing on is Holder.java. We've created the bare bones of that class but have not filled in any of the methods. You will need to understand what they do and how they do it in order for the program to work. To see how it should work, you should try running the demo, and then see what parts of the code are missing.

Good Luck!