Exercises
-
D.7 What is the value of
x
after each of the following statements is executed?x = Math.abs( 7.5 );
x = Math.floor( 7.5 );
x = Math.abs( 0.0 );
x = Math.ceil( 0.0 );
x = Math.abs( -6.4 );
x = Math.ceil( -6.4 );
x = Math.ceil( -Math.abs( -8 + Math.floor( -5.5 ) ) );
-
D.8 (Parking Charges) A 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 ...
Get Android How to Program, 3/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.