作者vicman (林小目)
看板ESOE-92
标题ex_2
时间Mon Mar 20 16:26:40 2006
import java.util.Scanner;
import java.text.DecimalFormat;
public class bbb {
public static void main(String[] args) {
double a,b,c,w;
DecimalFormat threeDecimal = new DecimalFormat("00.000");
Scanner A = new Scanner (System.in) /*artificial sweetener*/;
Scanner B = new Scanner (System.in) /*the weight of the mouse*/;
Scanner C = new Scanner (System.in) /*kilogram you want to lose*/;
System.out.println(" print the number of artificial sweetener to kill a
mouse ");
a = A.nextDouble();
System.out.println(" Then, print the weight of the mouse ");
b = B.nextDouble();
System.out.println(" OK , print how many kilogram you want to lose");
c = C.nextDouble();
w = a*c*10/b;
System.out.println("The maximal diet soda that you can drink is ");
System.out.print(threeDecimal.format(w));
System.out.println(" kg " );
}
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.4.242