Create two different constructor methods

Assignment Help JAVA Programming
Reference no: EM131908169

Assignment

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.

Attachment:- Java-Code.rar

Reference no: EM131908169

Questions Cloud

Globalizing the cost and availability of capital : llustrates alternative paths to globalizing the cost and availability of capital. Why do you think the strategic path to sourcing equity starts with debt?
Contributions to charitable remainder trust in future : Kati would like to have the flexibility to make additional contributions to the charitable remainder trust in the future.
What are the chances of loan being approved : What is the loan to loan-to-value ratio for a $400,000 loan? What are the chances of this loan being approved?
Disposition of assets before death : "Trust is the disposition of assets upon death of grantor while Will helps the settlor with the disposition of assets before his death.
Create two different constructor methods : Create two different constructor methods. Create a simple main program (main() ) that displays several snowmen of different colors.
What is the project net present value : If the discount rate of 14.6 percent, what is the project's net present value?
What is the value of this firm if you ignore taxes : What is the value of this firm if you ignore taxes?
Explain the rationale for your decision : You are the manager of a factory of the Make-It Company. You have 5,000 parts that must be shipped by Friday at 5:00 p.m.
What will the total finance charge be : How much will your monthly payment be? What will the total finance charge be?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd