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

 

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

Write a method that returns the sum of a, b, and c. The sum will always include c, but it will only include a if useA is true. The sum will only include b if useB is true. For example: strangeSum(2,6,10,true,false) will return 12 since 2+10=12. Notice that the 6 was not inluded in the sum because useB was false.


strangeSum(15, 20, 100, true, true) → 135
strangeSum(15, 20, 100, true, false) → 115
strangeSum(15, 20, 100, false, false) → 100

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

public int strangeSum(int a, int b, int c, boolean useA, boolean useB) { }

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