8 kyu

Tip Calculator

6,652 of 16,527Katbow

Description:

Complete the function, which calculates how much you need to tip based on the total amount of the bill and the service.

You need to consider the following ratings:

  • Terrible: tip 0%
  • Poor: tip 5%
  • Good: tip 10%
  • Great: tip 15%
  • Excellent: tip 20%

The rating is case insensitive (so "great" = "GREAT"). If an unrecognised rating is received, then you need to return:

  • "Rating not recognised" in Javascript, Python and Ruby...
  • ...or null in Java
  • ...or -1 in C#

Because you're a nice person, you always round up the tip, regardless of the service.

Fundamentals

More By Author:

Check out these other kata created by Katbow

Stats:

CreatedNov 28, 2015
PublishedNov 28, 2015
Warriors Trained25549
Total Skips1295
Total Code Submissions83171
Total Times Completed16527
JavaScript Completions6652
Ruby Completions784
Python Completions5715
Java Completions3025
CoffeeScript Completions19
C# Completions787
Total Stars222
% of votes with a positive feedback rating90% of 2071
Total "Very Satisfied" Votes1715
Total "Somewhat Satisfied" Votes294
Total "Not Satisfied" Votes62
Ad
Contributors
  • Katbow Avatar
  • jhoffner Avatar
  • Javatlacati Avatar
  • GiacomoSorbi Avatar
  • anter69 Avatar
  • alessandrodalbello Avatar
  • Chrono79 Avatar
  • Souzooka Avatar
  • hobovsky Avatar
  • user8436785 Avatar
  • ejini战神 Avatar
  • Just4FunCoder Avatar
  • KayleighWasTaken Avatar
Ad