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

 

dsawyer@methacton.org intro_p4_level_1 > monkeySale
prev  |  next  |  chance

There's a sale on monkeys at the zoo. Given the number of monkeys, this method returns the total cost of those monkeys. They are only $5 each and every monkey you buy after the first 10 monkeys only cost $4 each. If the customer asks for a negative number of monkey, the cost is zero dollars and one strange look.


monkeySale(4) → 20
monkeySale(11) → 54
monkeySale(12) → 58

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

public int monkeySale( int num ){ }

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

Copyright Nick Parlante 2017 - privacy