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

 

quiz2021_10_04_APSLHL_guards


Write a method that analyzes the famous "guard" scene from "Monty Python and the Holy Grail". There are conditions named 'stay', 'guard', 'awake', and 'preventLeave'. Each of these conditions means something specific in the scene. You do NOT have to know about the scene though! All you have to do is return the number of these conditions that are 'true'. Look at the test data for examples.


quiz2021_10_04_APSLHL_guards(true, true, true, true) → 4
quiz2021_10_04_APSLHL_guards(false, false, true, false) → 1
quiz2021_10_04_APSLHL_guards(false, true, true, true) → 3

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

public int quiz2021_10_04_APSLHL_guards(boolean stay, boolean guard, boolean awake, boolean preventLeave) { }

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