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.)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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.

The image displays a simple scene created in a graphical environment labeled "BlueJ Shapes Demo." This scene features two stylized houses placed side by side against a white background, with a yellow circle representing the sun in the upper left corner.

### Detailed Description:

1. **Sun**:  
   - Located in the top-left section of the image.
   - Represented by a yellow circle, suggesting a sunny day.

2. **Houses**:
   - **Left House**:
     - **Shape**: A red square represents the body of the house.
     - **Roof**: A green triangle sits atop the red square, forming the roof.
     - **Window**: A blue square is positioned within the body of the house, suggesting a window.
   
   - **Right House**:
     - **Shape**: A blue square forms the body of the house.
     - **Roof**: A black triangle acts as the roof of this house.
     - **Window**: A yellow square is placed within the blue square, indicating a window.

The use of simple geometric shapes and primary colors makes this a clear and easy-to-understand diagram for educational purposes, particularly useful for teaching basic shapes and colors to young students.
Transcribed Image Text:The image displays a simple scene created in a graphical environment labeled "BlueJ Shapes Demo." This scene features two stylized houses placed side by side against a white background, with a yellow circle representing the sun in the upper left corner. ### Detailed Description: 1. **Sun**: - Located in the top-left section of the image. - Represented by a yellow circle, suggesting a sunny day. 2. **Houses**: - **Left House**: - **Shape**: A red square represents the body of the house. - **Roof**: A green triangle sits atop the red square, forming the roof. - **Window**: A blue square is positioned within the body of the house, suggesting a window. - **Right House**: - **Shape**: A blue square forms the body of the house. - **Roof**: A black triangle acts as the roof of this house. - **Window**: A yellow square is placed within the blue square, indicating a window. The use of simple geometric shapes and primary colors makes this a clear and easy-to-understand diagram for educational purposes, particularly useful for teaching basic shapes and colors to young students.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 8 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY