Part A. Enhance the Bug2
class from Homework 5 Part A so that
the bug draws itself as a small red triangle with the tip facing the direction
in which it moved. Construct three Point2D.Double objects for the vertices.
Draft: Just draw a red dot.
Part B. Reimplement the Bug2
class from Homework 4 part A as a
class Bug3
, so that all methods continue to work the same way, but
the internal data representation is changed. You must use the following
instance variables:
private Point2D.Double position; private double angle;
You may not use any other instance variables.
Draft: Replace dx
and dy
with angle
but keep x
and y
.
Part C. Modify the Bug2
class from Homework 3 part C as a class
Bug4
, with the following changes:
new Bug(30, 40)
has x-coordinates
between 0 and 30 (inclusive), and y-coordinates between 0 and 40.x
and y
coordinates are width
/ 2
and height / 2
. dx
and dy
of the bug are (1, 1),
making it face north-east.Draft: Just the constructor, no change to move
.