CST 112 Final Exam
Modify your Project #4 code
to use arrays of Object.
Make a copy of your
modify it as described below.
Store your final code in a new file named
by 5pm Tuesday 5/19.
M O D I F I C A T I O N S
(1.) Increase the number of Racers
from three to five.
You will also need six buttons and four varmits.
- Replace the three racer objects
with an array of five Racer objects.
- (Modify the screen size, if necessary.)
- Replace the four buttons with
with an array of six buttons.
- (Make sure each button is same color as corresponding Racer.)
- Replace the two Varmits with
with an array of four Varmits.
- Use for
loops to traverse the arrays.
- Do not refer to individual racers, such as
r or r;
- instead, use
within the repeating block of each for loop.
- To make things easier, use the subscript number
as the "name" of each racer.
is the subscript of a racer
in an array r,
then this statement changes its name:
(2.) Add markers across the tracks,
Use a while loop to display the lines and triangles,
as shown in this screen-shot:
should apply for arrays of objects in q4.
Define and use these object classes:
Properties should be defined within the object class.
(Global variables should not be used within the class.)
A racetrack with
parallel tracks (horizontally).
In each track, a racer
(a random amount)
when its button is clicked.
Each racer is a different color,
and drawn with at least three shapes..
Buttons are used to make the racers move:
must be the same color as its corresponding racer
display the name
of that racer,
An additional button moves ALL
After the race begins,
run back and forth between the tracks
(bouncing off the ends).
- Racers and Varmits should all display some sort of animation, as they move.
- The title and author must appear on the screen.
When a racer crosses the finish line,
the winner's name