CST112 Project 8: Chapter 8
-
The difference between full credita grade of 10 out of ten points or
less on this assignment generally is contingent on the complexity of the design
,
so be as creative as you can since all students are completing the same basic assignment
-
Design a
class
(create this class using the "New Tab" command and save it as
a separate file) with some object of your own that moves around the Processing output window
(this should be a different object than the ones you created for any previous project)
-
The size of the output window should be 400 by 500 pixels or larger (the
width
and height
should not be the same)
-
Your class minimally will need instance variables (attributes) to store:
- The x- and y-coordinates of the object
- The x and y 'speed' values
-
The class should contain the following methods:
- The constructor method that initializes the instance variables
-
drawObject
()
there is no movement in this
method, just draw the object at the current x- and y-coordinate
locations; you might consider renaming this method to reflect
whatever object you are drawing (for example if your object is a
dog, the method could be called drawDog()
-
moveObject
()
the object should move both
horizontally and vertically as well; in this method add the current
values of the x and y 'speed' variables to the x- and y-coordinate
variables (you also could rename this method to reflect whatever
object you are drawing)
-
bounceObject
()
when the object reaches
any of the output window borders it should reverse direction;
in this method reverse the polarity of the 'speed' variables
so that when the object reaches the left or right border, it should
change direction horizontally and when it reaches the top or bottom
border, it should change direction vertically (you also could rename
this method to reflect whatever object you are drawing)
-
To increase your grade
you may add other methods with additional functionality that implement
your own creativity
-
The primary requirement of this assignment is that
you define a class (a significantly reduced grade if you do not)
with a "list" of attributes that are initialized in the constructor method
and manipulate those class attributes in the displayObject
()
,
moveObject()
and bounceObject()
methods;
declare and instantiate at least two objects from the class and call all three
(or more) of its methods for both (all) objects
-
Click this Play Project 8
link to view a sample application which demonstrates the type of functionality
that should be built into your sketch; however this is just an example since
your assignment is to create something completely different
-
Insert comments at the beginning of the program for the
assignment project number, your name and e-mail address, the date of
submission, and a brief description of what the program does; additionally
comment each of the sections of code, including a comment at the beginning
of each of the programmer-defined functions and methods
-
Students may work on all projects in teams of two or three,
and, if so, all students in the group must submit the same project to their own dropboxes
in Blackboard. In the text box's dropbox, as well as in the source code documentation
(comments), state the name(s) of the classmate(s) with whom you worked.
-
The completed project archived into a ".ZIP" file submitted
electronically via an attachment to a
Brightspace
dropbox is due to Prof. Struck no later than 11:59 p.m. on the date
listed in the course outline.