about | help | code help+videos | done | prefs |
For this problem you will write a rational function parser. It will accept a string representation of a polynomial function for the numerator followed by a string representation of a polynomial function for the denominator and then an integer value for x. Your method will then return a double that is equivalent to the y-value output of that function for the given x-value input parameter. Each polynomial will have positive integer coefficients and non-negative single-digit integer exponents. Exponents of 1 or 0 must be explicit in the polynomial and may NOT be implied (for example "x+2" must be passed in as "1x^1+2x^0"). All coefficeints must be explicitly indicated, so "x^2" must be passed in as "1x^2". You may assume that the denominator will not be zero for the given input value. rationalParse("2x^3+1x^2+4x^1+6x^0", "1x^2", 3) → 9.0 rationalParse("8x^1", "2x^1", 7649) → 4.0 rationalParse("1x^0", "1x^2+5x^1+6x^0", 11) → 0.005494505494505495 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 440
Copyright Nick Parlante 2017 - privacy