I know the rules about the homework and me posting code or an attempt to make it.
I have no clue at the moment on how to approach this. I understand what
Degree() will do.
But with coefficient(power) i just see a function that uses something like a switch command .like if 3 is put in, it will return a number that u already put into the switch command.
is it possible to do these without prepluggin in these numbers?
3.7 Recall that a polynomial in a single variable has the form a0xm + a1xm- 1 + a2xm-2 + … + an-2x2 + an-1x + an. An example of a polynomial is 4x12 - 3x10 + 5x8 + x4 -12x2 + x - 6. Notice that not all exponents may be included in a polynomial. Implement an ADT to represent a polynomial in a single variable x whose operations include the following:
// Returns the degree of the polynomial.
// Returns the coefficient of the xpower term.
// Replaces the coefficient of the xpower term with
For this problem consider only polynomials whose exponents are nonnegative integers. As the programmer, you will decide what data is to be stored and how that data is to be stored. What data type will you use to represent information for each node in this polynomial? What data structure will best represent any polynomial you wish to create?
Write a short program to test your ADT. Remember to separate your definition and implementation of this ADT into two files. Create a third file for your test program.
I dont know what youre on about with the switch statement, but what I'd guess youre meant to do in pseudo code would be:
Then if your coefficient (or constant) is not going to be > 255 you can pack each coeff into a different byte in your variable.
for power = 1 to degree()
coeff = coefficient(power)
there was already a thread on this very assignment. search.
Not only that, but it's by emeight here too:
Originally Posted by m37h0d
Apparently, the answers in the first thread weren't good enough, so let's start another and see if the answers are any better? My son, who is four, uses the technique of asking mum first, then me if the answer was not "good enough". A more mature individual would probably discuss the answers, rather than just asking the same question to someone else.