about | help | code help+videos | done | prefs |
Write a method that returns one of three things: either the sum of a and b, the product of a and b, or -1 as an error code. Return the product if 'op' is the times symbol: *. Return the sum if 'op' is the plus symbol: +. Return the error code if 'op' is any other symbol, or if either of the numbers passed in are negative. quiz2021_10_21_APSLHL_operation(5413, 34, "+") → 5447 quiz2021_10_21_APSLHL_operation(-1, 23, "*") → -1 quiz2021_10_21_APSLHL_operation(-5, -5, "+") → -1 ...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: 220
Copyright Nick Parlante 2017 - privacy