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

 

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

Write a method that returns either the sum of a and b, or their product, depending on if 'add' is true or not. If 'add' is true, return the sum of a and b. If 'add' is false, return the product of a and b. Look at the test data for examples.


quiz2021_10_12_APSLHL_addOrMult(23, 2, true) → 25
quiz2021_10_12_APSLHL_addOrMult(11, 1, false) → 11
quiz2021_10_12_APSLHL_addOrMult(11, 11, false) → 121

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

public int quiz2021_10_12_APSLHL_addOrMult(int a, int b, boolean add) { }

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: 210

Copyright Nick Parlante 2017 - privacy