RE: Coding Challenge #2 – Polynomial

You are viewing a single comment's thread from:

Coding Challenge #2 – Polynomial

in coding-challenge •  7 years ago 

@raggaemuffin I'm not sure what you are asking us to code here. We take a string that is a polynomial, change it to a math code, and then return the same string we started with? Are we factoring, simplifying, solving, or plugging in a solution value for x?

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:  

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?

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 :)