老师,不好意思,我当时的作业(第一题)忘交正方形部分的代码了,能不能考虑一下
package graphics_seh;
import java.text.DecimalFormat;
public class Square {
public double edge;
public double getCircumference() {
DecimalFormat s = new DecimalFormat("#.##");
double circumference;
circumference = 4 * edge;
String m = s.format(circumference);
System.out.println("该正方形的周长为:"+m);
return circumference;
}
public double getArea()
{
DecimalFormat t = new DecimalFormat("#.##");
double area;
area = edge * edge;
String n = t.format(area);
System.out.println("该正方形的面积为:"+n);
return area;
}
}