Question: Stuck on getting the GO functions coded to satisfy the questions below: Here's the source code used to answer the questions above: package main import
Stuck on getting the GO functions coded to satisfy the questions below:

Here's the source code used to answer the questions above:
package main import ( "fmt" "math" )
//this is where the GO functions are added }
func main() { fmt.Println(compPoly(1, 2, -4, 2.5)) // Should see 7.25
fmt.Println(calcRoots(2, -11, 5)) // Should see 0.5 5 fmt.Println(calcRoots(3.14, 1, 4)) // Should see NaN NaN
strs1 := []string{"the", "lazy", "dog"}; strs2 := []string{"the", "quick", "brown", "fox"}; fmt.Println(lastToFirst(strs1)) // Should see true fmt.Println(lastToFirst(strs2)) // Should see false }
. 1. a function compPoly that takes 4 parameters: a, b, c and x and returns ax2 + bx + c the parameters and return type are all of type float64 An example result: compPoly(4,-10,5, 3) should return 11 (4*3*3 10 * 3 + 5 = 36 30 + 5 = 11) It makes sense to test the function with simple values so you can easily check if you have a correct answer, but the type really does need to be of type float64. The grader will be running test code that expects this 2. A function calcRoots that takes 3 parameters: a, b, c and uses the quadratic formula to return the two roots the parameters and both return values are again all of type float64 the first return value should be (-b sqrt(b2-4ac))/2a, while the 2nd return value should be (-b + sqrt(b2-4ac))/2a if the determinant (b2-4ac) is negative, return the NaN value (for not a number) for both roots Besides needing conditional code, this function has you use the math library for Go, too. The Sqrt() and NaN() functions will give you what you need. Ex: calcRoots (2, -11, 5) should return 0.5, 5, while calcRoots (3.14, 1, 4) would return NaN, NaN 3. A function lastToFirst that takes a slice of strings and returns true if the list is in strictly decreasing order, using the default ordering for strings This function gives you a reason to use a loop Ex: lastToFirst ( [] string{ "guard", "dog", "chases"}) should return true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
