Question
Using MatLab: You have been hired by a used-car dealership to modify the price of the cares that are up fpr sale. Write a function
Using MatLab:
You have been hired by a used-car dealership to modify the price of the cares that are up fpr sale. Write a function called usedCar that takes in a structure with the following fields:
Make: A string that represents the make of the car(e.g."Toyota")
Year: A number that correspons to the year of the car(e.g. 2017)
Cost: A number that holds the marked price of the car(e.g. 12,000)
Miles: The numbe of miles clocked (e.g. 85,000)
Accidents: The number of accidents the car has been in (e. g. 1)
Your function should return a structure with all the above field, with exactly the same names. Here are the changes you must make within the function regarding a input car structure parameter:
1. Add 3,000 to the cost if the car has clocked less than 20,000 miles
2.substract 3,000 if it has clocked more than 100,000 miles.
3. reduce the price by 5,000 for every accident. make sure the reduced price is no less than $1000 (If the reduced price is less than 1000, keeps the price at 1000).
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