Today's classwork focuses on graphics, inheritance and ArrayList.
Snarf the L0927 to get started.
BouncingBall class so that it
remembers the size of the ball. Thus, instead of using a constant value like RADIUS,
each ball could have a different size. Note that since the ball is
round, the height and width in Dimension will be the same size. Change the constructor of BouncingBall so
that the size can be set when the object is created, that is pass in
the size as a parameter. This means that you should delete the
constants RADIUS and DIAMETER and instead use the size that you are
passing in.
Canvas constructor so that
it creates two BouncingBall objects of different sizes.
BouncingSmileythat represents
a smiley
face
that can bounce off the walls like a BouncingBall. It
should share the state of a BouncingBall (how do you share state between
a super class and its subclass?) and move the same as a
BouncingBall.
It will be painted differently.
Your smiley face should be able to be constructed with at least a
center position, size, and velocity.
Your smiley face should have at least a head,
two eyes,
and
mouth that are correctly positioned
and sized proportionally to the center and size given when the class is
created. Note that you will need to change the pen color before drawing
the eyes and mouth.
Feel free to be creative about adding extra features to your smiley face (e.g., a hat, nose, teeth, headband, etc.).
Note to draw a shape, you specify the top-left point in the bounding box, the height and width.
Canvas constructor
so that it creates two BouncingSmiley objects
of different positions and sizes in addition to the original
BouncingBall objects, so you should have two bouncing balls
and two bouncing smileys.
Put both of your names at the front of your README file if you worked with a partner.
Electronically submit through Eclipse your Java code and README file to the Lab14 folder.