Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. IF STATEMENT PROBLEMS (1) Write a script where based on the score of a test (

ID: 3706154 • Letter: 1

Question

1. IF STATEMENT PROBLEMS (1) Write a script where based on the score of a test (e.g. a number score, 74) returns a grade for that score, either "A", "B", "C", "D", or "F" (2) Write a script to determine the cost of an automobile insurance premium, based on driver's age and the number of accidents that the driver has had. The basic insurance charge is $500. There is a surcharge of $100 if the driver is under 25 and an additional surcharge for accidents: TABLE 1. Automobile insurance exercise number of accidents Accident Surcharge 50 125 225 375 575 >5 2. EXERCISES FROM DE BOER NOTES (1) Exercise 1.0. (2) Exercise 1.1. (3) Exercise 1.2. Code and solve using MATLAB. Use ? 1 and 20, Assume system start with not pesticide in the body. Plot pesticide concentration vs time.

Explanation / Answer

1)

function grad = calGrades(score)

if((score >= 90) && (score<=100))
grad = 'A';
end
if((score >= 80) && (score<=89))
grad = 'B';
end
if((score >= 70) && (score<=79))
grad = 'C';
end
if((score >= 60) && (score<=69))
grad = 'D';
end
if((score >= 0) && (score<=59))
grad = 'F';
end

calGrades(85)

2)

function cost = calCost(age, numacc)

cost = 500
if(age<25)
cost = cost+100
end
if(numacc == 1)
cost = cost+50
end
if(numacc == 2)
cost = cost+125
end
if(numacc == 3)
cost = cost+225
end
if(numacc == 4)
cost = cost+375
end
if(numacc >= 5)
cost = cost+575
end

calCost(24, 4)