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

 

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

Write a method that returns the product of 'num1' and 'num2' unless 'add' is true (meaning that we want to add the numbers instead). If 'add' is true, return the sum of 'num1' and 'num2'.


test2022_10_06_APP1SLHL_addOrMult(true, 15, 10) → 25
test2022_10_06_APP1SLHL_addOrMult(false, 3, 7) → 21
test2022_10_06_APP1SLHL_addOrMult(true, 3, 7) → 10

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

public int test2022_10_06_APP1SLHL_addOrMult(boolean add, int num1, int num2) { }

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

Copyright Nick Parlante 2017 - privacy