展开全部
import java.util.Scanner;
public class Cfx {
private static double Apple;
private static double Banana;
private String Earth;
private String Sun;
private Cfx() {
}
private void setCfx(double Apple, double Banana) {
this.Apple = Apple;
this.Banana = Banana;
}
public void setApple(double Apple) {
this.Apple = Apple;
}
public void setBanana(double Banana) {
this.Banana = Banana;
}
public double getApple() {
return this.Apple;
}
public double getBanana() {
return this.Banana;
}
public double getEarth() {
return (Apple + Banana) * 2;
}
public double getSun() {
return Apple * Banana;
}
public static void main(String[] args) {
Scanner a = new Scanner(System.in);
System.out.println("请输入长方形的长:");
Apple = a.nextDouble();
System.out.println("请输入长方形的宽:");
Banana = a.nextDouble();
System.out.println("长方形的周长是:" + new Cfx().getEarth() + "长方形的面积是:" + new Cfx().getSun());//getEarth()周长是调这个函数32313133353236313431303231363533e78988e69d8331333335346131 //getSun()面积是这个
}
}