Question: Solve in Matlab by using Script file: Problem 3 Write a program in a function file that calculates the cost of renting a car according

Solve in Matlab by using Script file:

Solve in Matlab by using Script file: Problem 3 Write a program

Problem 3 Write a program in a function file that calculates the cost of renting a car according to the following price schedule Type of car Rental period 7-27 days 1-6 days 28-60 days Class BS27 per day S162 for 7 days, +S25 S662 for 28 days, +S23 for each additional day. for each additional day Class CS34 per day S204 for 7 days, +S31 S284 for 28 days, +S28 for each additional day. for each additional day Class DClass D cannot be$276 for 7 days, +S43 S1,136 for 28 days, rented for less than 7 d for each additional day.+S38 for each additional da Input to the function file are the class of the car and the number of days of rental; the outputs are the status and the cost, where the status is a message "OK" if a cost is calculated. Also, status is a message, "Rental is not available for more than 60 days", if a period longer than 60 days is entered; or a message, "Sorry, Class D cars cannot be rented for less than 6 days" if a rental period of less than 6 days is entered for class D Write a program in script file that asks the user to enter the rental period and the type of car. Use fpxintf command to display the type of car and the number of days requested in one line and the cost and the status from the function file in the next line Run the program nine times for the following cases Class B, for 3, 14, and 50 days. Class C, for 20, 28 and 61 days. Class D for 6, 18, and 60 days. (Use of a for loop is recommended) Problem 3 Write a program in a function file that calculates the cost of renting a car according to the following price schedule Type of car Rental period 7-27 days 1-6 days 28-60 days Class BS27 per day S162 for 7 days, +S25 S662 for 28 days, +S23 for each additional day. for each additional day Class CS34 per day S204 for 7 days, +S31 S284 for 28 days, +S28 for each additional day. for each additional day Class DClass D cannot be$276 for 7 days, +S43 S1,136 for 28 days, rented for less than 7 d for each additional day.+S38 for each additional da Input to the function file are the class of the car and the number of days of rental; the outputs are the status and the cost, where the status is a message "OK" if a cost is calculated. Also, status is a message, "Rental is not available for more than 60 days", if a period longer than 60 days is entered; or a message, "Sorry, Class D cars cannot be rented for less than 6 days" if a rental period of less than 6 days is entered for class D Write a program in script file that asks the user to enter the rental period and the type of car. Use fpxintf command to display the type of car and the number of days requested in one line and the cost and the status from the function file in the next line Run the program nine times for the following cases Class B, for 3, 14, and 50 days. Class C, for 20, 28 and 61 days. Class D for 6, 18, and 60 days. (Use of a for loop is recommended)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!