Question: JAVA Write a class that represents a digital snowman. Your class should follow these guidelines: Store the following private class variables a. bodyColor of type

JAVA

JAVA Write a class that represents a digital snowman. Your class shouldfollow these guidelines: Store the following private class variables a. bodyColor of

Write a class that represents a digital snowman. Your class should follow these guidelines: Store the following private class variables a. bodyColor of type Color. b. int x, int y for the upper left comer. c. Graphics g. 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 comer 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 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. 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. Add a changes no ManColor() method to the Snowman. a. This should change the snowman to a random color. b. Then it redraws the snowman Create a loop in the main program that will change the color of one of the snowmen to a random color 10 times. Sample output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!