1. Construct an m-file that calculates the total cost of renting a car according to the fol- lowing price table: Sedan SUV Rent Daily | Free distance Cost for Every | Daily | Free distance | Cost for Every Rate (per day) 79 TL | 80 km (per day) 84 TL | 80 km 64 TL | 120 km Duration Rate Additional km Additional km 1-29 days 30 or more 59 TL | 120 km days 1 TL 1 TL 2 TL 2 TL First of all, the code prompts the user to enter the type of car (Sedan or SUV), the number of days (rent duration), and the total distance (km) driven as three user defined inputs. The m-file should display the total cost for the rent with a message ""The total cost of the rent is . TL" according to the entered user-defined inputs. As an example, if a Sedan car is rented for 10 days and 1000 km is driven totally with this car, then the calculation according to the given table will be as (10 days * 79 TL)+((1000 km – (10 days * 80 km)) * 1 TL) = 990 TL. Another example; if a SUV is rented for 35 days and 4500 km is driven totally with this car, then the calculation according to the given table will be as (35 days * 64 TL)+((4500 km – (35 days * 120 km)) * 2 TL) = 2840 T L. Here, the examples are given to you in order to explain the mathematical calculation needed in the code.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
100%
1. Construct an m-file that calculates the total cost of renting a car according to the fol-
lowing price table:
Sedan
SUV
Free distance Cost for Every | Daily
(per day)
Rent
Daily
Free distance Cost for Every
(per day)
84 TL | 80 km
64 TL | 120 km
Duration
Rate
Additional km
Rate
Additional km
79 TL 80 km
30 or more 59 TL | 120 km
1-29 days
1 TL
1 TL
2 TL
2 TL
days
First of all, the code prompts the user to enter the type of car (Sedan or SUV), the
number of days (rent duration), and the total distance (km) driven as three user defined
inputs. The m-file should display the total cost for the rent with a message ""The total
cost of the rent is ... TL" according to the entered user-defined inputs.
As an example, if a Sedan car is rented for 10 days and 1000 km is driven totally with
this car, then the calculation according to the given table will be as
(10 days * 79 TL) + ((1000 km – (10 days * 80 km)) * 1 TL) = 990 TL.
Another example; if a SUV is rented for 35 days and 4500 km is driven totally with this
car, then the calculation according to the given table will be as
(35 days * 64 TL) + ((4500 km – (35 days * 120 km)) * 2 TL) = 2840 T L.
Here, the examples are given to you in order to explain the mathematical calculation
needed in the code.
Transcribed Image Text:1. Construct an m-file that calculates the total cost of renting a car according to the fol- lowing price table: Sedan SUV Free distance Cost for Every | Daily (per day) Rent Daily Free distance Cost for Every (per day) 84 TL | 80 km 64 TL | 120 km Duration Rate Additional km Rate Additional km 79 TL 80 km 30 or more 59 TL | 120 km 1-29 days 1 TL 1 TL 2 TL 2 TL days First of all, the code prompts the user to enter the type of car (Sedan or SUV), the number of days (rent duration), and the total distance (km) driven as three user defined inputs. The m-file should display the total cost for the rent with a message ""The total cost of the rent is ... TL" according to the entered user-defined inputs. As an example, if a Sedan car is rented for 10 days and 1000 km is driven totally with this car, then the calculation according to the given table will be as (10 days * 79 TL) + ((1000 km – (10 days * 80 km)) * 1 TL) = 990 TL. Another example; if a SUV is rented for 35 days and 4500 km is driven totally with this car, then the calculation according to the given table will be as (35 days * 64 TL) + ((4500 km – (35 days * 120 km)) * 2 TL) = 2840 T L. Here, the examples are given to you in order to explain the mathematical calculation needed in the code.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education