题目内容
import java.util.Scanner;public class Application2_5 {public static void main (String args[ ]) {Scanner reader = new Scanner(System.in);double weight,chargeWeight,charge;System.out.printf("输入行李重量:");weight = reader.nextDouble();【代码1】 //将 (int)weight赋值给chargeWeightSystem.out.printf("行李重量:%f(kg),火车的计费重量:%f(kg)\n",weight,chargeWeight);【代码2】 //将chargeWeight*12.6的值赋值给chargeSystem.out.printf("用火车托运的费用:%f元\n", charge);【代码3】//将 (int)(weight+0.5)赋值给chargeWeightSystem.out.printf("行李重量:%f(kg),汽车计费重量:%f(kg)\n",weight,chargeWeight);【代码4】//将chargeWeight*22.5的值赋值给chargeSystem.out.printf("用汽车托运的费用:%f元\n", charge);}}
查看答案
搜索结果不匹配?点我反馈