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

 

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

Write a method that accepts three boolean and three integer parameters. The boolean parameters indicate if the following integer parameter is supposed to be included in the sum or not. For example, if the method is called with this parameter list: (true, 20, false, 17, true 5) it means that 20 and 5 are supposed to be included in the sum, but 17 is not. So the method would return 25. Look at the test data for further examples.


quiz2020_09_21_P1SLHL_includeSum(true, 250, true, 742, false, 45) → 992
quiz2020_09_21_P1SLHL_includeSum(false, 9280, true, 321, false, 325) → 321
quiz2020_09_21_P1SLHL_includeSum(true, 22350, true, 1243, false, -2545) → 23593

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

public int quiz2020_09_21_P1SLHL_includeSum(boolean b1, int n1, boolean b2, int n2, boolean b3, int n3) { }

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

Copyright Nick Parlante 2017 - privacy