car race codes..
Step 1 ?20 marks
Create the Car class. Each car has attributes for Odometer (int), Speed (int) and atPitstop (boolean). Have getters and setters for each.
Note on attributes:
The odometer is the total number of spaces the car has moved. For example, after 2 laps (when you create the CarDriver Main program), its odometer will be 80. Starting value is 0. Speed starts at 0.
atPitstop is a Boolean and starts at false. When the car lands in the atPitstop, this changes to true, and the car doesn抰 move on the next throw. After it has waited a turn, atPitstop changes to false and the car can continue.
Step 2 ?20 marks
The Aim here is to get one car to race around, without the special squares of atPitstop and speedBoost.
Create the Main program, called CarDriver. Here you will create an instance of the Car and the Die class. Have a variable called trackLength, just in case you would like to change it later. Use a while loop so the car races around for 10 laps.
Use a method to handle changes to the track position of the car. In this method you will get the old odometer reading, with getOdom(), add the die roll to it, and set the new odometer reading, with setOdom().
Use the following formula to give you the number of laps covered:
laps = carOne.getOdom() / trackLength;
This formula will tell you have many spaces you have covered in the current lap ( from (0,0):
inLap = carOne.getOdom()%( trackLength).
Each time the die is rolled, you should print out from the main values move number, die value, the lap number and the position in the lap.
Step 3 ?15 marks
Add the special squares atPitstop and speedBoost. Note that these squares should work the same even if the trackLength is changed.
Print out the speed. When you get a speed boost print out 揧ipee ?Extra Speed!!!!!!!!!!!!!!!!?br>
When you land in the atPitstop print out 揥HOA ?In the Pitstop?br>
Step 4 ?15 marks
Add a second car.
Print out something like ?Car One is winning by 34 spaces?after each move.
this is my assignment...
i just want few intro to this..
because im new to this..
i know how to start..
i seem to be stuck at middle part....

