Hi Guys,
This is the first time am doing java and i have been struggling to find out whats wrong with this program....when ever i try running it ...it says Java Class Definition error
public class Ex0603
{
public static void main(String[] args)
{
System.out.prin tln("Circles");
showCircle(1.5) ;
showCircle(2);
showCircle(5.7) ;
showCircle(7);
showCircle(25);
}
static void showCircle(doub le r)
{
Circle c = new Circle(r);
String str = "Radius: " + c.getRadius() + "\t"
+ "Area: " + c.getArea() + "\t"
+ "Circumfere nce: " + c.getCircumfere nce();
System.out.prin tln(str);
}
}
class Circle
{
double radius1;
Circle(double r)
{
radius1=r;
}
double getRadius()
{
double rad;
return(rad);
}
double getArea()
{
double Area;
Area=Math.PI*ra dius1*radius1;
return(Area);
}
double getCircumferenc e()
{
double Circumference,r adius;
Circumference=2 * Math.PI * radius1;
return(Circumfe rence);
}
}
This is the first time am doing java and i have been struggling to find out whats wrong with this program....when ever i try running it ...it says Java Class Definition error
public class Ex0603
{
public static void main(String[] args)
{
System.out.prin tln("Circles");
showCircle(1.5) ;
showCircle(2);
showCircle(5.7) ;
showCircle(7);
showCircle(25);
}
static void showCircle(doub le r)
{
Circle c = new Circle(r);
String str = "Radius: " + c.getRadius() + "\t"
+ "Area: " + c.getArea() + "\t"
+ "Circumfere nce: " + c.getCircumfere nce();
System.out.prin tln(str);
}
}
class Circle
{
double radius1;
Circle(double r)
{
radius1=r;
}
double getRadius()
{
double rad;
return(rad);
}
double getArea()
{
double Area;
Area=Math.PI*ra dius1*radius1;
return(Area);
}
double getCircumferenc e()
{
double Circumference,r adius;
Circumference=2 * Math.PI * radius1;
return(Circumfe rence);
}
}
Comment