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

 

orion.a.smith@gmail.com apcsa-primitives > apcsaPrimitivesMultiplyOrAddOperands1
prev  |  next  |  chance

This function multiplies the parameters if the third parameter has the value true, and returns the result of the multiplication. If the third parameter has the value false, the function adds the parameters instead and returns the sum.


apcsaPrimitivesMultiplyOrAddOperands1(2, 4, true) → 8
apcsaPrimitivesMultiplyOrAddOperands1(2, 4, false) → 6
apcsaPrimitivesMultiplyOrAddOperands1(-3, 4, true) → -12

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

public int apcsaPrimitivesMultiplyOrAddOperands1(int a, int b, boolean shouldMultiply) { }

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: 100 Post-solution available

Copyright Nick Parlante 2017 - privacy