Write a class that represents a digital snowman. Your class should follow these guidelines: 1. Store the following private class variables a. bodyColor of type Color. b. int x, int y for the upper left corner. c. Graphics g. 2. Create two different constructor methods. a. A (int x, int y, Graphics myG) parameter constructor that makes the snowman a light gray color by default and makes x and y the upper left corner and saves the graphics panel to draw on. b. A (int x, int y, Graphics myG, Color c) parameterized constructor that requires a color as an input and then saves the color given in addition to the x and y and the graphics panel. c. Each constructor should set /save the appropriate bodyColor to the necessary Color 3. Create a public drawSnowMan() method a. Instantiate three Ovals that draw the body of the snowman. b. Make sure to shift/translate the ovals based upon the proper x and y. c. Your Ovals should be filled with whatever color bodyColor is set to. d. Create several Objects to draw eyes, nose and mouth on the snowman e. Create Lines to draw stick arms for the snowman. 4. Create a simple main program (main() ) that displays several snowmen of different colors. a. Create an array of 3 snowmen. b. Snowman 0 should use the default constructor and hence should be gray. c. Snowman 1 and 2 should be set to a non-gray color of your choice. d. After making the snowmen, make sure to draw them to the screen. 5. Add a changeSnowManColor() method to the Snowman. a. This should change the snowman to a random color. b. Then it redraws the snowman 6. Create a loop in the main program that will change the color of one of the snowmen to a random color 10 times. You can use the panel.sleep(300) method in your main program/loop to slow it down to see the changes.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a class that represents a digital snowman. Your class should follow these guidelines: 1. Store the following private class variables a. bodyColor of type Color. b. int x, int y for the upper left corner. c. Graphics g.

2. Create two different constructor methods. a. A (int x, int y, Graphics myG) parameter constructor that makes the snowman a light gray color by default and makes x and y the upper left corner and saves the graphics panel to draw on. b. A (int x, int y, Graphics myG, Color c) parameterized constructor that requires a color as an input and then saves the color given in addition to the x and y and the graphics panel. c. Each constructor should set /save the appropriate bodyColor to the necessary Color

3. Create a public drawSnowMan() method a. Instantiate three Ovals that draw the body of the snowman. b. Make sure to shift/translate the ovals based upon the proper x and y. c. Your Ovals should be filled with whatever color bodyColor is set to. d. Create several Objects to draw eyes, nose and mouth on the snowman e. Create Lines to draw stick arms for the snowman.

4. Create a simple main program (main() ) that displays several snowmen of different colors. a. Create an array of 3 snowmen. b. Snowman 0 should use the default constructor and hence should be gray. c. Snowman 1 and 2 should be set to a non-gray color of your choice. d. After making the snowmen, make sure to draw them to the screen.

5. Add a changeSnowManColor() method to the Snowman. a. This should change the snowman to a random color. b. Then it redraws the snowman

6. Create a loop in the main program that will change the color of one of the snowmen to a random color 10 times. You can use the panel.sleep(300) method in your main program/loop to slow it down to see the changes.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education