#C14352. Car Rental Price Calculation
Car Rental Price Calculation
Car Rental Price Calculation
You are given a task to calculate the total cost of renting a car. The car has a base daily rate of \(\$40\) per day. Discounts are applied depending on the duration of the rental period:
- If the car is rented for 3 or more days, a discount of \(\$20\) is applied.
- If the car is rented for 7 or more days, a discount of \(\$50\) is applied instead.
Note: Only one discount is applied. For example, if the rental period is 7 days or more, only the higher discount of \(\$50\) is applied (and the \(\$20\) discount is ignored) regardless of the fact that it also qualifies for the lower discount.
Your program should read the number of rental days from standard input, calculate the total cost with the appropriate discount, and output a text string exactly in the format:
The total cost for renting the car for X days is: $Y
where X is the number of days and Y is the computed total cost.
inputFormat
The input consists of a single integer from standard input that represents the number of days the car is rented.
outputFormat
Output a single line to standard output that describes the total cost in the following format:
The total cost for renting the car for X days is: $Y
Make sure to include the exact spacing and punctuation as shown.
## sample2
The total cost for renting the car for 2 days is: $80