- 鐵幣
- 31 元
- 文章
- 12 篇
- 聲望
- 2 枚
- 上次登入
- 09-7-26
- 精華
- 0
- 註冊時間
- 06-9-22
- UID
- 311972
|
import java.io.*;
public class trapezoid{
public static void main(String args[]) throws Exception{
String get_up,get_down,get_high;
double t_up,t_down,t_high,trapezoidArea;
double pi=3.14159;
BufferedReader up= new BufferedReader(new InputStreamReader(System.in));
System.out.println("請輸入上底:");
get_up=up.readLine();
BufferedReader down= new BufferedReader(new InputStreamReader(System.in));
System.out.println("請輸入下底:");
get_down=down.readLine();
BufferedReader high= new BufferedReader(new InputStreamReader(System.in));
System.out.println("請輸入高:");
get_high=high.readLine();
t_up=Double.parseDouble(get_up);
t_down=Double.parseDouble(get_down);
t_high=Double.parseDouble(get_high);
trapezoidArea=(t_up+t_down)*t_high/2;
System.out.println("梯形面積等於:"+trapezoidArea);
}
}
[ 本文最後由 Hunag 於 06-10-3 09:15 PM 編輯 ] |
|