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

 

pais@kinetigram.com > L512_makeChocolate
prev  |  next  |  chance

APCS Logic 5, Problem 12 (hard, but easy if you reuse makeBricks code.). We want make a package of goal kilos of chocolate. We have small bars (1 kilo each) and big bars (5 kilos each). Return the number of small bars to use, assuming we always use big bars before small bars. Return -1 if it can't be done.


L512_makeChocolate(4, 1, 9) → 4
L512_makeChocolate(4, 1, 10) → -1
L512_makeChocolate(4, 1, 7) → 2

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

public int L512_makeChocolate(int small, int big, int goal) { }

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

Copyright Nick Parlante 2017 - privacy