about | help | code help+videos | done | prefs |
Write a method that will either add 'num1' and 'num2' or subtract them, depending on the value of 'add'. If 'add' is true, you add the two numbers. If 'add' is false you subtract them. If you end up subtracting the two numbers, you will subtract 'num2' from 'num1'. Look at the test data for examples. Remember: You may only use ONE return statement in a method! (My rule!) test2023_09_08_APP1SLHL_addOrSubtract(5, 2, true) → 7 test2023_09_08_APP1SLHL_addOrSubtract(-9, 1, true) → -8 test2023_09_08_APP1SLHL_addOrSubtract(-15, 10, false) → -25 ...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: 210
Copyright Nick Parlante 2017 - privacy