Write a tester class snowmanjava with a main method that


Part 1. ?Write a class Square.java?similar to Circle that has attributes:

? x?and y?­ the coordinates of the center of the square

? halfSide?­ half of one side of the square

? color?­ the color of the square.

The class should have a constructor that takes two coordinates and the side. You will need to convert the side to half side.

public Square (double inputX, double inputY, double inputSide)

The class should also have the following methods

? public void draw()?­ for drawing the square. (Used the method StdDraw.filledSquare?)

? public void setColor(Color newColor)?­ method that changes the color of the square.
? public double getArea()?­ that returns the area of the square
? public double getPerimeter()??­ that returns the perimeter of the square.

Part 2. ?Write a tester class Snowman.java?, with a main method that creates different objects of the classes Square and Circle to create a snowman. You can use your creativity to build different parts of the snowman. Print the area and perimeter of each object that you create

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a tester class snowmanjava with a main method that
Reference No:- TGS01117023

Now Priced at $35 (50% Discount)

Recommended (91%)

Rated (4.3/5)