看板 ESOE-92 關於我們 聯絡資訊
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