怎么用java计算梯形面积 Suppose that bases of a trapezoid are 8.9 and 12.1,and that the height is 16.Use Dr.Java's interactions pane to declare variables for the bases,height,and area,assign values,and compute the area.What code did you type

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 12:02:35
怎么用java计算梯形面积 Suppose that bases of a trapezoid are 8.9 and 12.1,and that the height is 16.Use Dr.Java's interactions pane to declare variables for the bases,height,and area,assign values,and compute the area.What code did you type
xSAk@+4醄P*MO^W &fdw&LVV)xPz*l/mil6_pfQ {S7o{KOϫן 9X.gt"ϙ 3$!F `@ 9#FR@æM]O/ ]f2L"QB7KY]@%0* GT0Hq2Ҋ GnQ2^g< yH2>*Ԯ6 M, K1* 9b!{\ރVpZ()NwVCmb-EL3\^ EdE<" (K!6򱁃:x|sI8zQ{@vy 7e[tڵ,vu(uIկNթ*B趃:a-±,8Tw5c/ov~!T1"KNWC׽ܦqkTH

怎么用java计算梯形面积 Suppose that bases of a trapezoid are 8.9 and 12.1,and that the height is 16.Use Dr.Java's interactions pane to declare variables for the bases,height,and area,assign values,and compute the area.What code did you type
怎么用java计算梯形面积
Suppose that bases of a trapezoid are 8.9 and 12.1,and that the height is 16.Use Dr.Java's interactions pane to declare variables for the bases,height,and area,assign values,and compute the area.
What code did you type to declare the four variables you needed?
What code did you type to assign values to the bases and the height?
What code did you type to compute the area?
What is the area of this trapezoid?


怎么用java计算梯形面积 Suppose that bases of a trapezoid are 8.9 and 12.1,and that the height is 16.Use Dr.Java's interactions pane to declare variables for the bases,height,and area,assign values,and compute the area.What code did you type
public class Test{
//梯形面积的方法
//a为梯形上底,b为梯形下底,h为梯形高,area为面积
public double area(double a,double b,double h){
double area;
//梯形面积公式:(上底+下底)*高/2
area=(a+b)*h/2;
return area;
}
//使用mian()方法实现
public static void main(String [] args){
Test t=new Test();
System.out.print("梯形面积为"+t.area(8.9,12.1,16));
}
}