Exercises
6.7 What is the value of
xafter each of the following statements is executed?-
double x = Math.abs(7.5); -
double x = Math.floor(7.5); -
double x = Math.abs(0.0); -
double x = Math.ceil(0.0); -
double x = Math.abs(-6.4); -
double x = Math.ceil(-6.4); -
double x = Math.ceil(-Math.abs(-8 + Math.floor(-5.5)));
-
6.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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access