Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab format only please Problem 3 (35 Points) A used-car dealership has hired you to modify the price of cars that are up for sale.

Matlab format only please

image text in transcribed

Problem 3 (35 Points) A used-car dealership has hired you to modify the price of cars that are up for sale. Ina script, assign the initial information about the car to a structure called carlnfo. The structure shall have the following fields: ID: An identification number for the vehicle Make: A string that represents the make of the car Year: A number that corresponds to the year of the car Price: A number that holds the marked price of the car Miles: The number of miles clocked Accidents: The number of accidents the car has been in Write a user-defined function called usedCar that receives the structure carlnfo and changes each cars price depending on a number of factors. The function should return the structure with the following adjustments to the price field. 1. Add $2,500 to the price, if the car has clocked less than 15,000 miles. 2. Reduce the price by $1,000 if it has clocked more than 190,000 miles. 3. Reduce the price by $1500 for each accident. Run the script with the following input data set: YearPrice ($) ID Make Miles Accidents (prior to modification) 299 132 Volvo Subaru 2016 2003 40,000 6,000 10,000 200,000 0 2 Print the adjusted Price of each car using fprintf() commands in the following format: Car ID Adjusted Price 299 132 $42500 $2000 Problem 3 (35 Points) A used-car dealership has hired you to modify the price of cars that are up for sale. Ina script, assign the initial information about the car to a structure called carlnfo. The structure shall have the following fields: ID: An identification number for the vehicle Make: A string that represents the make of the car Year: A number that corresponds to the year of the car Price: A number that holds the marked price of the car Miles: The number of miles clocked Accidents: The number of accidents the car has been in Write a user-defined function called usedCar that receives the structure carlnfo and changes each cars price depending on a number of factors. The function should return the structure with the following adjustments to the price field. 1. Add $2,500 to the price, if the car has clocked less than 15,000 miles. 2. Reduce the price by $1,000 if it has clocked more than 190,000 miles. 3. Reduce the price by $1500 for each accident. Run the script with the following input data set: YearPrice ($) ID Make Miles Accidents (prior to modification) 299 132 Volvo Subaru 2016 2003 40,000 6,000 10,000 200,000 0 2 Print the adjusted Price of each car using fprintf() commands in the following format: Car ID Adjusted Price 299 132 $42500 $2000

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

Question

full presentation about organic function material

Answered: 1 week ago