Question: This has to be in GO programming language Start by creating a folder and running the standard initialization command: go mod init cs311/hw1 The go.mod
This has to be in GO programming language
Start by creating a folder and running the standard initialization command: go mod init cs311/hw1 The go.mod file should look like: module cs311/hw1 go 1.17 Now edit the file hwl.go so it is in package main . C 1. a function comp Poly 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: comp Poly (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 (-6 + 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 NaNO 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 last To First 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 . . . Submit your "hw1.go file to Blackboard. The grader will assume you have followed the directions here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
