RE: Coding Challenge #2 – Polynomial

You are viewing a single comment's thread from:

Coding Challenge #2 – Polynomial

in coding-challenge •  7 years ago 

I understand it like this:

  1. you get a polynomial (like described) and parse it.
  2. implement functions 'add', 'subtract', ... etc.
  3. implement toString() method (to see the result of implemented operations).

Am I correct on this one?

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

So, does it come with a second input to plug in for x, then?

@bandli is correct. You get a string representation of a polynomial and should implement a class that parses that and allows to fo math with it:

a = Polynomial('3x^2')
b = Polynomial('5x^4')
c = a.multiply(b)
c.toString => '15x^6'

If you want to have an evaluate method that could be fun too

It might help a lot if you have one or two examples like this in your post, so we can include them in our test cases. It makes understanding the problem at hand a bit easier. In the real world I would say "specifications unclear" and send it back to the Product Owner ;)

You are right! I wanted to post it and probably should have refined the specification a bit before that. Next challenge I'll see to make up to that

Oh! You want us to create a polynomial class and return an object of that given polynomial! Is that it?

I want you to create a polynomial class that has a constructor accepting a string :)