Java-how-to-program(第六版)答案第六章--1.docVIP

  • 9
  • 0
  • 约1.1万字
  • 约 14页
  • 2019-07-03 发布于浙江
  • 举报

Java-how-to-program(第六版)答案第六章--1.doc

第六章 方法的深入剖析 6.7结果如下: a)7.5 b)7.0 c)0.0 d)0.0 e)6.4 f)6.0 g)-14.0 6.8程序代码为: import java.util.Scanner; public class Exercise1_2 { public static void main( String args[]) { Exercise1_2 e = new Exercise1_2(); Scanner input = new Scanner( System.in ); int time; double account = 0.0; System.out.println(Enter the park time or end with -1:); time = input.nextInt(); while ( time != -1 ) { System.out.printf(Charge with $%.3f\n, e.calculateCharge( time )); account += e.calculateCharge( time ); System.out.println(Enter the park time or end with -1:);

文档评论(0)

1亿VIP精品文档

相关文档