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

 

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

There's a sale at the local Pencil store. Each pencil cost $2 but you can get 4 for only $7. Given the number of pencils, this method returns the total cost of those pencils.


pencils(3) → 6
pencils(11) → 20
pencils(-2) → 0

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

public int pencils( 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