write a class Circle with one double data radius . write motheds :::
public Circle(),public Circle (double),public Circle (Circle c)
public getPerometer(int)where the parameter indicates the number of terms for π
public getArea (int) where the parameter indicates the number of term for π
public String toString ()
public Boolean equals( Circle c)
private double getpi(int) which returns the value of π corresponding to the specified number of terms ..
...finally test your class in main

``````/**
* @(#)Circlee.java
*
*
* @author
* @version 1.00 2011/10/17
*/

public class Circlee {
public Circle(){
}
}

public String toString(){

}

}

}``````

if you can help me to understand this question .plz
i realy need to understand because i have tommorow exam and its will help me ..
all thanks ...

First of all, use capital letters to ask questions and write normal sentences.
Your question in terms of steps, I am not on a write your code for you.
- Make all the methods in your class, empty.
- Think of what each method should actually do (e g the method getRadius, should return the radius).
- Write perimeter in stead of perameter.
- Use a general form for writing your methods, like getPerimeter(), GetPerimeter() or getperimeter(), and use that throughout your entire program.

i have error with the type ..
can you correct me plz

``````public class Circle {
public Circle(){
}
}
public Circle(Circle c){
}
}
}
public int getPerimeter(int perimeter){
return perimeter;

}
public int getArea(int area){
return area;
}

}``````

Are you a native English speaker? You write radius with i-u... (doesn't really matter)

Where do you get an error? Which line? And do far it looks good. Just keep going like this, and use your logic.

``perimeter=2*(Math.PI)*(int)raduis;``
``area=(Math.PI)*(int)raduis*(int)raduis;``

because area is int and raduis is double ??
how i can write this step ....
private double getpi(int) which returns the value of π corresponding to the specified number of terms ..

Are you a native English speaker? You write radius with i-u... (doesn't really matter)

QUOTE]
actully no ..
i starting to learn english

OK, that's great, you're doing quite well so far :). I am just asking you to type with normal sentences and capital letters.

The problem with the area: Change the type of area and the return type of the method to double. Also, you do not need a input in the method getArea(). Only a return value.

``````public double getArea(){
return Math.PI*Math.pow(raduis,2); // You can return without making a variable.
}``````

Explanation: Every time you cast a double variable to int, you lose all the information behind the decimal point. So to return a double, and keep all the information you return as it is.
If you must return an int, use the following code:

``````public int getArea(){
}``````

If the area is 3.99237, the method will return 3.

``````public double getPerimeter( ){
}
public double getArea( ){
}``````

public getPerometer(int)where the parameter indicates the number of terms for π
public getArea (int) where the parameter indicates the number of term for π
now the above method i wroted correctly ?

private double getpi(int) which returns the value of π corresponding to the specified number of terms ..
... is this mean to write private double Pi=3.14 ;

The code you wrote looks perfect to me.

The methods you have to make for your assignment seem a little stupid to me, I don't really understand their meaning.
The only idea I can come up with, is the number of decimals PI should have in the calculation. You could use the DecimalFormat class for that, I don't have any experience there, you should Google it.

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.