Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

5. Prepare for the role of interviewee

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago