CST 112
Final Exam

Starting with the class definitions and code in solar.pde , make modifications and add your own code to accomplish the following:
  1. Change the value of many from 4 to 8.

  2. In Button class, write new constructor(s) with multiple arguments.
  3. In Planet class, write new constructor(s) with multiple arguments.
  4. In setup() method, replace the initialization code for the two arrays with loops that construct all of the objects in each array and use the new constructors, with arguments taken from the arrays such as namelist[].

  5. In the buttons() method, write a loop to show all of the buttons (and remove the old code).
  6. In the showall() method, write a loop to display all of the planets (and remove the old code).

  7. Add code in mousePressed() to make the buttons work (similarly to the code already inkeyPressed[]).

  8. Add a sortDistance() method (at the bottom) then activate the 'd' key and the 'distance' button.

  9. Add code to display a title and your name on the screen.
  10. Change the flag() method to display a "Coast Guard Ensign" consisting of thirteen vertical stripes of white and red.

    • It is strongly suggested that you do these last tasks (title, name, and flag) FIRST,
      BEFORE starting the harder tasks, to make sure you get full credit for them, in class.


Upload your final code to your folder
in a file named xy-final.pde
where "XY" are your own initials.

After tonight's class, you may
revise and improve your code
then upload it by Wednesday evening,
to another file named xy-revised.pde .

Be sure that all uploaded code
will compile correctly in the Processing PDE.
Code that fails to compile will NOT be graded!


NOTE: The links and images below are NOT part of the assignment; they are merely for information only.

Planets