CMPS 4350 Lab-13
Programming challenge
Files on odin:
4350/d/lab13.cpp
4350/d/Makefile
Description of program:
You are going to rotate the tires on your car. This means that the four
wheels of the car will be re-arranged. When you are done, the same four
wheels will be on the car, but each will be in a different position.
To accomplish this you will use your spare tire. At each step, you will
jack up the car, remove one tire, and replace it with the tire not currently
on the car.
To start, the spare tire is off the car.
step-1: Remove tire #1 and replace it with the spare tire.
Tire #1 is now off the car.
step-2: Remove tire #2 and replace it with tire #1.
Tire #2 is now off the car.
step-3: Remove tire #3 and replace it with tire #2.
Tire #3 is now off the car.
step-4: Remove tire #4 and replace it with tire #3.
Tire #4 is now off the car.
step-5: Remove the spare tire and replace it with tire #4.
The spare tire is now off the car, and you are done.
1. Define a data structure representing the car. This data structure will
hold the four tires on the car. Tires 1, 2, 3, 4.
2. Define a data structure that will hold the one tire that is not on the car.
To start, it will be your spare tire.
3. Perform the 5 steps described above to rotate the car's tires.
4. Display your data structure values to begin.
After each step above, display the data structure holding the car's tires.
You may also display which tire is off the car.
Design your tire rotation data structure and algorithm so that it would
work for rotating the tires on a motorcycle with 2 or 3 wheels, a large
pickup truck with 6 wheels, or a semi-trailer truck with up to 18 wheels.
The number of wheels on your vehicles may be input from the command-line.
Note:
Do not over-complicate this program.
Use the simplest data structure possible. Use the simplest algorithm.
Complexity is not the goal.
Simplicity is the goal.
Files will be collected at end of lab.