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_SLHL_includeSumArray
prev  |  next  |  chance

Write a method that accepts an array of boolean and an array of integer parameters. The boolean parameters indicate if the integer parameter with the same index is supposed to be included in the sum or not. Look at the test data for further examples. As preconditions, you may assume that the two arrays have the same length.


quiz2020_09_21_SLHL_includeSumArray([false, true, false], [1427, 23548, 436]) → 23548
quiz2020_09_21_SLHL_includeSumArray([false, true, true, true], [1, 2, 3, 4]) → 9
quiz2020_09_21_SLHL_includeSumArray([true, true, true, false], [5, 100, 3000, 72000]) → 3105

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

public int quiz2020_09_21_SLHL_includeSumArray(boolean[] b, int[] n) { }

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

Copyright Nick Parlante 2017 - privacy