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: Duratiorn Sedan SUV Daily rate Free miles Cost of Daily

image text in transcribed

The following table shows the price for renting a car at a car rental company: Duratiorn Sedan SUV Daily rate Free miles Cost of Daily rate Free miles Cost of [days] per dayadditional per dayadditional 69.99 59.99 30 or more39.99 100 120 140 miles [$] 0.69 0.59 0.39 89.99 79.99 59.99 100 120 140 miles [$] 0.89 0.79 0.59 1-10 11-29 Write a MATLAB program in a script file HW5P4.m that calculates 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 the rent is xxxx.xx $." where XXXX.XX is the cost value in $ ents) for the rent in a sentence that reads: "The cost of Run the program three times for the following 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. The data should be displayed in f format with two decimal digits

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

Students also viewed these Databases questions