O'Reilly logo

Java™ How to Program, Seventh Edition by P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercises

6.7What is the value of x after each of the following statements is executed?
  1. x = Math.abs( 7.5 );

  2. x = Math.floor( 7.5 );

  3. x = Math.abs( 0.0 );

  4. x = Math.ceil( 0.0 );

  5. x = Math.abs( -6.4 );

  6. x = Math.ceil( -6.4 );

  7. x = Math.ceil( -Math.abs( -8 + Math.floor( -5.5 ) ) );

6.8A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write an application that calculates and displays the parking charges for each customer who parked in the garage yesterday. You should enter the hours parked for each customer. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required