Posted by: zeePa November 5, 2008
Java lovers, please help me
Login in to Rate this Post:     0       ?        

Create a class named MyRectangle to represent rectangles. The required data fields are width, height, and color. Use double data type for width and height, and a String for color. Suppose that all rectangles are the same color. Use a static variable for color. Provide the accessor methods for the properties and a method findArea() for computing the area of the rectangle.....Write a program to test your class MyRectangle. In the client program, create two MyRectangle objects. Assign a width and height to each of the two objects. Assign the first object the color red, and the second, yellow. Display all properties of both objects including their area.

God is it that tough? WHy is it freaking me out? guys help me. I framed it a lil bit.

 

public class MyRectangle{

private double width = 1;
private double height = 1;
private static String color = "white";

public MyRectangle(){

}

public MyRectangle(double widthParam, double heightParam, String colorParam){

}

public double getWidth(){

}

public void setWidth(double widthParam){

}

public double getHeight(){

}

public void setHeight(double heightParam){

}

public String getColor(){

}

public static void setColor(String colorParam){

}

public double findArea(){

}
}


Read Full Discussion Thread for this article