| about | help | code help+videos | done | prefs |
Given two numbers, a and b, and a character c which represents a mathematical operator (+, -, *, /), return the result of the mathematical expression. If the operator is not one of those listed, the calculate method should return -1. calculate(1.5, 2.5, "-") → -1.0 calculate(2.2, 3.3, "+") → 5.5 calculate(4, 5, "?") → -1.0 ...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: 150 Post-solution available
Copyright Nick Parlante 2017 - privacy