lab2
public class abc
{
public static void main(String[] args)
{
double mouseWeight=4;
double mouseLossWeight=0.02;
double sweetener=20;
double mouseDrink=100;
double WomanWeight=60;
double mouseSodaLimit=sweetener*100;
double WomanLimit=mouseSodaLimit*(WomanWeight/mouseWeight);
double loseWeight=mouseLossWeight*(WomanLimit/mouseDrink);
System.out.println("老鼠有 "+mouseWeight+"kg");
System.out.println("老鼠喝了 "+mouseDrink+"cc 蘇打就會減少 "+mouseLossWeight+"kg");
System.out.println("老書吃了"+sweetener+"g 人工代糖就會死掉");
System.out.println("如果老鼠吃超過"+mouseSodaLimit+"cc 的蘇打就會死掉");
System.out.println("一個想減肥的女人體重"+WomanWeight+"kg.");
System.out.println("他最多只可以喝 "+WomanLimit+"cc 蘇打 ");
System.out.println("而他最多可以減少"+loseWeight+"kg .");
}
}
結果
0 Comments:
Post a Comment
<< Home