Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. a function comp Poly that takes 4 parameters: a, b, c and x and returns ax2 + bx + c the parameters and return

image text in transcribed

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 (-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 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago