Question

Police Car Cost

Captain Joseph Friday, the police administrator in Port Ormond, would like to estimate the mileage at which a police cruiser should be replaced. Data analyses show that the total operation cost (gas, maintenance, and so on) is approximated by:

f = v*m t s* m2 Cc=f=v∗m+s∗m2

where f, v, and s are constant coefficients based on the city, the shifts, and the drivers, and m is the mileage reading (in thousands) on the car’s odometer.  

The police department has an arrangement with Generous Motors for trade-ins of used police cruisers. The automaker has agreed to reduce the price of a new cruiser by the following amount:

r p* d2r=p∗d2

where r is the trade-in value of a used cruiser, p is the original (new) car price, d is a depreciation factor, and m is the mileage (in thousands) as defined above. Assuming the cost of the new car doesn’t change, the depreciation cost of the vehicle is p-r, the difference between the new car price and the trade-in value.

Therefore the total cost of the car is c + (p-r). The cost per a thousand mile is c+p-r m c+p−rm.

Your task is to develop a program in Matlab that determines the mileage (to the nearest 1000 miles) at which cruisers should be replaced, meaning it has the lowest cost per 1000 miles. Prompt the user for values for f, v, s, p, and d (in that order). You should verify that p is greater than 0 and that d is between 0 (not included) and 1 (included). You should then output a table as shown in the sample output below. You should also determine and print out the mileage with the lowest cost per 1000 miles. You may assume that General Motor is not willing to trade in a vehicle past 100,000 miles. The example run is shown below.

Enter value for f: 2000 Enter value for v: 200 Enter value for s: 3 Enter value for p: 20000 Enter value for d: .95 |Miles To

48848.00 19854.62 49627.00 * 19861.89 69488.89 50412.00 19868.80 70280.80 51203.00 19875.36 71078.36 52000.00 19881.59 71881.

f = v*m t s* m2 C
r p* d2
c+p-r m
Enter value for f: 2000 Enter value for v: 200 Enter value for s: 3 Enter value for p: 20000 Enter value for d: .95 |Miles Total Operation Depreciation Cost/kMiles 2203.00 1000.00 $ 3203.00 3203.00 2 2412.00 1950.00 $ 4362.00 2181.00 2627.00 2852.50 3 5479.50 1826.50 4 2848.00 3709.88 6557.88 1639.47 3075.00 4524.38 3308.00 5298.16 3547.00 6033.25 9580.25 1368.61 3792.00 6731.59 $ 10523.59 s 7599.38 1519.88 6 8606.16 1434.36 7 1315.45 8 40 40-
48848.00 19854.62 49627.00 * 19861.89 69488.89 50412.00 19868.80 70280.80 51203.00 19875.36 71078.36 52000.00 19881.59 71881.59 68702.62 96 715.65 97 716.38 717.15 98 99 717.96 718.82 100 The vehicle should be replaced at 83,000 miles, for a cost/thousand miles of $710.65
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The equation for r used here is slightly different from the equation in the question as I have changed d^2 given in the question to d^m which is required to get the answer as given in the example. The matlab script follows..

f=input('Enter the value of f: ');
v=input('Enter the value of v: ');
s=input('Enter the value of s: ');
p=input('Enter the value of p: ');
d=input('Enter the value of d: ');
if p>0 && d>0 && d<=1
for m=1:100
    m_value(m)=m;
    c(m)=f+(v*m)+(s*m^2)%total operation cost
    r(m)=p*(d^(m)); %trade in value. This equation is slightly different from
    %the equation in the question as I have changed d^2 given in the
    %question to d^m which is required to get the answer as given in the
    %example.
    dip(m)=p-r(m);%depriciation cost
    t(m)=c(m)+p-r(m); %total cost of the car
    tm(m)=t(m)/m; %total cost per 1000 miles
end
arra=zeros(m,5);
arra(:,1)=m_value;
arra(:,2)=c;
arra(:,3)=dip;
arra(:,4)=t;
arra(:,5)=tm;
T=array2table(arra,'VariableNames',{'kMiles','Operation','Depiciation','Total','Cost_per_kMiles'})

[tm_min,tm_min_ind]=min(tm);%find min value of cost per 1000 miles and its index;
m_min=m_value(tm_min_ind)*1000;%Find distance with minimum cost per 1000 miles
sprintf('The vehicle should be replaced at %d miles for cost per kMiles of $ %f', m_min,tm_min)


else
    sprintf('Invalid values of p or d')
end

Add a comment
Know the answer?
Add Answer to:
Police Car Cost Captain Joseph Friday, the police administrator in Port Ormond, would like to estimate the mileage at wh...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT