import java.awt.Label;
public class Ladder {
double SD;
double XD;
double G;
double MJ;
Ladder(double SD1,double XD1,double G1)
{
SD = SD1;
XD = XD1;
G = G1;
}
double getMJ()
{
MJ = (SD + XD)*G/2;
System.out.println("面积是"+ MJ);
return MJ;
}
public static void main(String[] args)
{
Ladder L = new Ladder(3,8,6);
double mj = L.getMJ();
System.out.println(mj);
}
}
时间: 2024-12-28 16:11:52