### Assignment E

Primary focus on chapter 4 Making Decisions

Use the lab instructions given on the Internet at http://voyager.deanza.edu/~oldham
Use the same format for the opening comments as in assignment A, with your name, course and quarter, assignment, problem, and short problem description.

### Problem E1

The solution of the equation ax2 + bx + c has 6 cases, that can occur with various values of a, b, and c.
Test for these 6 cases in the order given here.
Do not compute any values until you have determined what calculations are needed.
The 6 cases are:

1. When a, b, and c are all zero, any value of x is a solution. Print: `Any value of x is a solution.`
2. When a and b are zero and c is not, no solution exists. Print: `No solution exists.`
3. When a is zero and b is not zero, the only solution is x = -c/b. Calculate the value of x and print the solution.

The remaining three cases are determined by the value of the determinant.
The determinant is b2 - 4ac.
Compute and save the value of the dererminant now.
You can use the value of the determinant you saved to select one of the remaining three cases.

4. When the determinant is zero, the only solution is x = -b/2a. Calculate the value of x and print the solution.
5. When the determinant is positive, two solutions are given by the following two expressions:
x1 = ( -b + b2 - 4ac ) / 2a
x2 = ( -b - b2 - 4ac ) / 2a
Print both solutions.
6. When the determinant is negative, the solutions have an imaginary component. Print: `The solutions have an imaginary component.`
If you are fimiliar with imaginary numbers, you may compute and print the result, but this is not required.

Test it 7 times:

• a = 0   b = 0   c = 0
• a = 0   b = 0   c = 4
• a = 0   b = 8   c = -12
• a = 2   b = 4   c = 2
• a = 2   b = 2   c = 0
• a = 100   b=100   c= -11
• a = 1   b = 1   c = 1

Check your results by hand, by substituting your results back into the equation and verify that they are roots.

### Problem E2

Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each test is 100 points. Determine the letter grade from the average of the test scores, using the following:

• 90% or more A
• 80% or more, but less than 90% B
• 70% or more, but less than 80% C
• 60% or more, but less than 70% D or F, to be determined from additional information
• less than 60% F

Only if the grade needs to be determined between D and F, allow the user to enter the number of homework assignments the student turned in, and the total number of homework assignments. If more than 80% of the homework assignments were turned in, the letter grade is D, otherwise F.

Test it 4 times:

• 96 84 90
• 95 83 90
• 70 59 60 with 5 homework out of 6 turned in
• 73 58 65 with 8 homework out of 11 turned in

Compute the results by hand and check your results.