package text1; import java.util.Scanner; public class text11 { public static void main(String[] args){ Scanner sc =new Scanner(System.in); System.out.print("输入圆的半径"); int a =sc.nextInt(); System.out.print("圆的周长是:"+a*2*3.14+"圆的面积是:
package jiekou1; public interface ShapePara { //定义常量PI final double PI=3.14; //定义抽象方法 //获得图形面积 double getArea(); //获得图形周长 double getCircumference(); } package jiekou1; public class Circle implements ShapePara { //定义成员变量 public double radius; public d
Problem Description There is a cycle with its center on the origin. Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other you may assume that the radius of the cycle
需求如下:(1)定义一个Circle类,包含一个double型的radius属性代表圆的半径,一个findArea()方法返回圆的面积. (2)定义一个类PassObject,在类中定义一个方法printAreas(),该方法的定义如下: public void printAreas(Cirlce c, int times) 在printAreas方法中打印输出1到time之间的每个整数半径值,以及对应的面积.例如,times为5,则输出半径1,2,3,4,5,以及对应的圆面积. 在main方法