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

 

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

It is almost Thanksgiving Day! That means we will be eating a bunch of turkey! Write a method that has an integer array as an input parameter. The array contains the number of slices of turkey you eat each day. The array can be any length, however, none of the elements will be negative. You are considered to have "stuffed yourself" with turkey if you ate more than 15 slices total, or if you ate more than 5 slices in one day. Write a method that returns true if you "stuffed yourself" or false otherwise.


piggy([3, 4, 1, 1, 0, 4, 2, 0]) → false
piggy([1, 0, 1, 2, 1, 5, 3, 1]) → false
piggy([2, 6, 0]) → true

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

public boolean piggy(int[] turkey) { }

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