/**
 * @(#)GeometricObject.java
 *
 * GeometricObject application
 *
 * @author 
 * @version 1.00 2012/9/10
 */

public abstract class GeometricObject {

private String color = "white";

public GeometricObject(){
    }
public GeometricObject(String color){
    }
public String getColor(){
    return color;
    }
public void setColor(String color){
    this.color=color;
    }
public String toString(){
    return " the color is " + color;
    }
    public abstract double getArea();
    public abstract double getPerimeter();
}
__________________________________________________________________________________________________
/**
 * @(#)Circle.java
 *
 *
 * @author 
 * @version 1.00 2012/9/10
 */


import java.util.Scanner;

public class Circle extends GeometricObject {

    private double radius; 

    public Circle (){
    }
    public Circle (double radius){
    radius=radius;
    }
    public double getRadius(){
        return radius;
    }
    public void setRadius(double radius){
        this.radius=radius;
    }
    public double getArea(){
        double area = Math.PI * radius * radius;
        return area;    
    }
    public double getPerimeter(){
        return 2 * radius * 3.142;
   }
    public void Radiuspls(){
        Scanner input = new Scanner (System.in);
        System.out.print("Enter the radius : ");
        double radius = input.nextDouble();
    }
    public String toString(){
        return "The circle with radius = " + radius + " with " + super.toString();
    }
    public String howToPrint (){
        return " using glossy paper " ;
    }

}
_______________________________________________________________________________________
/**
 * @(#)Rectangle.java
 *
 *
 * @author 
 * @version 1.00 2012/9/10
 */

import java.util.Scanner;

public class Rectangle extends GeometricObject{

    private double height;
    public double width;

    public Rectangle () {   
    }
    public Rectangle(double newWidth,double newHeight, String color){
        width = newWidth ;
        height = newHeight;     
        setColor(color);
    }
    public double getHeight(){
        return height;
    }
    public double getWidth (){
        return width;
    }
    public void setHeight(double newHeight){
        height = newHeight;
    }
    public void setWidth(double newWidth){
         width = newWidth;
    }
    public double getArea(){
        return height * width;
    }
    public double getPerimeter(){

       return 2 * (height + width); 
    }

    public void colorpls(){
        Scanner input=new Scanner(System.in);
        System.out.print(" Enter the color :");
        String mcolor=input.next();
        setColor(mcolor);
        }
   public String toString(){
        return "\nThe perimeter of Rectangle is " + getPerimeter() + super.toString();
  }
    public String howToPrint(){
        return "using A4 paper " ;
    }

}
________________________________________________________________________________________
/**
 * @(#)TestProgram.java
 *
 *
 * @author 
 * @version 1.00 2012/9/10
 */

import java.util.Scanner;

public class TestProgram {

    public static void main (String [] args) {

        myCircle.colorpls();
        setColor(mcolor);
        myCircle.Radiuspls();

        Circle myCircle = new Circle(radius);
        System.out.println(myCircle.toString() + myCircle.howToPrint());

        Rectangle myRectangle = new Rectangle();

        myRectangle.setWidth(5.4);
        myRectangle.setHeight(3.7);

        System.out.print("The area of rectangle with width of " + myRectangle.getWidth() +
                        " and with height of " + myRectangle.getHeight() + 
                        " is equal to " + myRectangle.getArea());
        System.out.println(myRectangle.toString()+ " and print " + myRectangle.howToPrint());

    }
}
______________________________________________________________________________________________

/**
 * @(#)Printable.java
 *
 *
 * @author 
 * @version 1.00 2012/9/10
 */


public interface Printable {

    public abstract String howToPrint ();

}
______________________________________________________________________________________________
 the error :

 --------------------Configuration: <Default>--------------------
C:\Documents and Settings\miit\Desktop\TestProgram.java:15: cannot find symbol
symbol  : variable myCircle
location: class TestProgram
        myCircle.colorpls();
        ^
C:\Documents and Settings\miit\Desktop\TestProgram.java:16: cannot find symbol
symbol  : variable mcolor
location: class TestProgram
        setColor(mcolor);
                 ^
C:\Documents and Settings\miit\Desktop\TestProgram.java:17: cannot find symbol
symbol  : variable myCircle
location: class TestProgram
        myCircle.Radiuspls();
        ^
C:\Documents and Settings\miit\Desktop\TestProgram.java:19: cannot find symbol
symbol  : variable radius
location: class TestProgram
        Circle myCircle = new Circle(radius);
                                     ^
4 errors

Process completed.

In class TestProgram, the main method instantiates myCircle AFTER it is called.

(just a guess ;-) )

cannot find symbol : variable myCircle

Where is the variable: myCircle defined? The compiler can not find its definition. You must define a variable BEFORE you try to use it.

Same with the other "cannot find" messages.

thanks for the comment... :) by the way i just solve it just now.. feel great of course.. thanks again for the feed back..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.