Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following table shows the price for renting a car at a car rental company: Sedan SUV Cost of additional Cost of Duration of rent
The following table shows the price for renting a car at a car rental company: Sedan SUV Cost of additional Cost of Duration of rent Daily rate Free additiona Daily rate Free davsl(rate/day) miles per miles(rate/day) miles per miles day (rate/mile)[S] 0.69 0.59 0.39 day (rate/mile) 1-10 11-29 30 or more 69.99 59.99 39.99 100 120 89.99 79.99 59.99 100 120 0.89 0.79 0.59 140 140 In your script file, calculate the cost of renting a car based on the shown price schedule. The program must prompt the user to enter the type of car (Sedan or SUV), the number of days, and the number of miles driven. The program then displays the cost (rounded to cents) for the rent in the following message: "The cost of the rent is $XXXX.xx." where XXXX.XX is the cost value in $. NOTE: Pay close attention to what each column header is. You may test your program with the following three cases: a) Sedan, 12 days, 1069 miles. b) SUV, 32 days, 6,096 miles. c) Sedan, 3 days, 511 miles. Hint: Use a switch-case structure for the type of the car (Sedan/SUV) with nested multiple if structure for the number of days and miles. Use fprintf ) to display the text and data
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started