id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > polyParse
prev  |  next  |  chance

For this problem you will write a polynomial parser. It will accept a string representation of a polynomial function and 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. The 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 "y=x+2" must be passed in as "y=1x^1+2x^0"). All coefficeints must be explicitly indicated, so "y=x^2" must be passed in as "y=1x^2"


polyParse("y=2x^6+5x^8+3x^1", 0) → 0.0
polyParse("y=5x^1+6x^0", -4) → -14.0
polyParse("y=1x^2+5x^1+6x^0", 3) → 30.0

...Save, Compile, Run (ctrl-enter)

public double polyParse(String poly, int x) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 380 Post-solution available

Copyright Nick Parlante 2017 - privacy