如有帮助,请采纳。点击我回答右上角【采纳】按钮。
public class Test{
public static void main(String[] args) {
double minPermiter=20;
double length=minPermiter/4;
double maxLength=2*length;
System.out.println("正方形周长为:"+4*maxLength+"厘米");
}
}
该题就是设置宽位x长为y
就有4x = y , 2*(x+y) = 20 两个函数。可得出x = 2,y = 8
周长就是 C正 = 4*8 = 32;
public class SquarePerimeter{
public static void main(String[] args) {
double C=20;
double x=C/10;
double y=4*x;
System.out.println("正方形周长为:"+4*y+"厘米");
}
}