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

 

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

Write a method that returns the sum of the two integers if the boolean variable add is true. Otherwise return the product of the two integers.


strangeCalculator(5, 6, true) → 11
strangeCalculator(3, 4, true) → 7
strangeCalculator(3, 4, false) → 12

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

public int strangeCalculator(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: 220

Copyright Nick Parlante 2017 - privacy