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

 

totalTicketPrice


Amy has invited n of her friends for a movie. Each ticket costs $10. There is a promotion where for every 5 tickets bought, one person gets free admission. Define a function that when passed the number of friends invited, returns the total amount.


totalTicketPrice(5) → 50
totalTicketPrice(4) → 50
totalTicketPrice(18) → 160

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

int totalTicketPrice(int n) { }

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: 3 Post-solution available

Copyright Nick Parlante 2017 - privacy