Homework 3 6/8/16, 10:20 PM

https://usflearn.instructure.com/courses/1112240/assignments/4649662#submit Page 1 of 2

Homework 3

Due Jun 15 by 12:30pm Points 30 Submitting a file upload

Available Jun 8 at 2:30pm – Jun 15 at 12:30pm 7 days

To exemplify pointers, we will be doing quadratics. Remember that a quadratic expression is of the form: ax2 + bx + c where a, b, c are constant

and a is not 0. You will scan in the values a, b, and c. With these values, you will write three functions:

quadraticFormula

quadraticVertex

quadraticInfo

The first function will preform the quadratic equation to find the roots of the expression. The return value of the function will be an int that

signifies how many REAL roots there are. You do not need to worry about imaginary numbers.

The second function is used to find the vertex of the expression. There is no return value for this function. Remember, there is an x and a y

component to vertex.

The third function function is to find the directrix and the direction the graph of the function is facing. There is no return value for this function.

The direction of the graph will be represented by a char that will either be ‘U’ for up or ‘D’ for down.

All of your printing and scanning should be done in main. You are scanning in integers, but you should be holding values in floats because

precision is important. When printing the roots, there are three cases. You will have two roots and will print two roots. You will have one root and

will print that one. Or you will have no real roots (probably resulting in some weird data in your variables) and will just print “No real roots”. You

will be using pointers to pass around to functions to hold values that are calculated. Print all floats to 2 decimal places. Scan all of your

coefficients on one line separated by spaces.

Sample Output:

Enter coefficents a, b, and c: 3 18 -48 3 18 -48

f(x) = 3x^2 + 18x + -48

Roots: 2.00 and -8.00

Vertex: (-3.00, -75.00)

Directrix: y = -75.08

The graph is facing up

Enter coefficents a, b, and c: 2 24 72 2 24 72

f(x) = 2x^2 + 24x + 72

Root: -6.00

Vertex: (-6.00, 0.00)

Directrix: y = -0.12

The graph is facing up

Enter coefficents a, b, and c: 1 4 5 1 4 5

f(x) = 1x^2 + 4x + 5

No real roots

Vertex: (-2.00, 1.00)

Directrix: y = 0.75

Homework 3 6/8/16, 10:20 PM

https://usflearn.instructure.com/courses/1112240/assignments/4649662#submit Page 2 of 2

The graph is facing up

Enter coefficents a, b, and c: -1 4 5 -1 4 5

f(x) = -1x^2 + 4x + 5

Roots: -1.00 and 5.00

Vertex: (2.00, 9.00)

Directrix: y = 9.25

The graph is facing down

Upload a file, or choose a file you’ve already uploaded.

File: Choose File no file selected

Add Another File

Click here to find a file you’ve already uploaded

Comments…

File Upload Google Doc

Cancel Submit Assignment

Sale!

# Homework 3 To exemplify pointers

$30.00

## Reviews

There are no reviews yet.