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

 

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

Write a method that finds the sum of all the integers in 'nums' but only if the corresponding index in 'include' is "true". So "true" in include means that you are to include the corresponding value in 'nums' in your sum. As a precondition you may assume that the two arrays are the same length.


test2021_04_22_APP1SLHL_includeOrNot([14], [false]) → 0
test2021_04_22_APP1SLHL_includeOrNot([14], [true]) → 14
test2021_04_22_APP1SLHL_includeOrNot([50, 100, -50], [true, true, true]) → 100

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

public int test2021_04_22_APP1SLHL_includeOrNot(int[] nums, boolean[] include) { }

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

Copyright Nick Parlante 2017 - privacy