View Single Post
  #1 (permalink)  
Old 11-14-2007, 05:30 PM
darkgt darkgt is offline
Member
 
Join Date: Nov 2007
Posts: 5
darkgt is on a distinguished road
help with rectangle class
Code:
public class Rectangle{ public static void main (String[]args){ Rectangle1 rectangle = new Rectangle1(); rectangle.setColor ("white"); rectangle.setHeight(1); rectangle.setWidth(1); System.out.println(rectangle.toString()); } } class Rectangle1 { private String color = "red"; private double height = 40; private double width = 4; Rectangle1 () { } public double getHeight(){ return height; } public double getWidth(){ return width; } public String getColor(){ return color; } //area and perimeter double getArea(){ return height* width; } double getPerimeter(){ return height*2 + width*2; } public String toString(){ return System.out.println("the area is" + area + "the perimeter is" + perimeter + "\n" + "color is" + color); } }


having a problem with the cannot find symbol area for the set commands. any ideas?

Last edited by JavaBean : 11-14-2007 at 05:36 PM.
Reply With Quote
Sponsored Links