Please Help Thanks Look at the course syllabus at the gradin

Please Help, Thanks

Look at the course syllabus at the grading scale. Create a script that calls for the user to input an overall score (i.e., a 93); the script needs to return the letter grade. Be sure to account for rounding the score. b) Write a function file that accepts the coefficients a, b, c (for the quadratic equation). Set up a code that evaluates b^2 - 4ac to determine if it will return a real value. If b^2 - 4ac is negative, display an error that tells the user that the squareroot is imaginary and abort the rest of the program. If b^2 - 4ac is zero or positive, calculate the squareroots and display them. Test your code on the following quadratic equations: x^2 - x + 12 4x^2 + 13x - 17 2x^2 - 4x + 2 c) Write a function file that determines the following sum (for all odd n from 1 to 11) using a for loop. The starting point, ending point, and increment should be input to the function file. y = sigma 2^n+2/n - 2 d) Repeat (c) using a while loop.

Solution

(a)

function [grade]=Grades(marks)

marks

if(marks>100)

grade=\'Invalid\';

elseif(marks>=90)

grade=\'O\';

elseif(marks>=80)

grade=\'A\';

elseif(marks>=70)

grade=\'B\';

elseif(marks>=60)

grade=\'C\';

elseif(marks>=50)

grade=\'D\';

else

grade=\'F\';

end

end

OUTPUT:

>> Grades(62)
marks =
62
ans =
C
>> Grades(92)
marks =
92
ans =
O
>> Grades(72)
marks =
72
ans =
B

(b)

function [roots]=determinant(a,b,c)

  

det=(b^2-4*a*c);

if det<0

fprintf(\'The roots are imaginary.\ \');

else

roots(1)=(-b+sqrt(b^2-4*a*c))/(2*a);

roots(2)=(-b-sqrt(b^2-4*a*c))/(2*a);

  

end

end

Output:

>> determinant(1,-1,12)

The roots are imaginary.

>> determinant(4,13,-7)

ans =

0.4704 -3.7204

>> determinant(2,-4,2)

ans =

1 1

(c)

sum=0;

for n=1:2:11

a=(2^(n+2))/(n-2);

sum=sum+a

end

Please Help, Thanks Look at the course syllabus at the grading scale. Create a script that calls for the user to input an overall score (i.e., a 93); the script
Please Help, Thanks Look at the course syllabus at the grading scale. Create a script that calls for the user to input an overall score (i.e., a 93); the script

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site