In blue j create a class and Add a public method named animate that has no parameter variables and returns nothing. Leave Add two House fields to the Scene. Call them house1 and house2. Add a sun field that can reference a Circle object. Add a moon field that can reference a Circle object. Create a no-arg constructor for the Scene class that creates the two House objects shown in the image below. Use the methods you created in the preceding activity to position and color the houses exactly as in the image. We will adopt the convention that house1 refers to the left house and house2 refers to the right house. Add a sun to the upper-left corner of the scene. (Create the sun object and set the color, position, and size in the no-arg constructor.)
In blue j create a class and Add a public method named animate that has no parameter variables and returns nothing. Leave
Add two House fields to the Scene. Call them house1 and house2.
Add a sun field that can reference a Circle object.
Add a moon field that can reference a Circle object.
Create a no-arg constructor for the Scene class that creates the two House objects shown in the image
below. Use the methods you created in the preceding activity to position and color the houses exactly
as in the image. We will adopt the convention that house1 refers to the left house and house2 refers
to the right house.
Add a sun to the upper-left corner of the scene. (Create the sun object and set the color, position, and
size in the no-arg constructor.)
In the animate method, move the sun across the sky until it moves completely off the right edge of
the window using the slowMoveHorizontal method for the sun object. Add a call to animate in your
main method just below the line that creates the Scene object. Now when you run main you should
see the sun move across the sky.
Add a blue moon object similar to how you added the sun. Place the moon initially off the screen to
the left of the sun. You could just copy the sun code and then move moon horizontally. In animate,
after the instruction that moves sun across the sky, make moon move slowly across the sky and stop
above house2.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 8 images