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
Similar Kata:
Stats:
Created | Nov 28, 2015 |
Published | Nov 28, 2015 |
Warriors Trained | 25549 |
Total Skips | 1295 |
Total Code Submissions | 83171 |
Total Times Completed | 16527 |
JavaScript Completions | 6652 |
Ruby Completions | 784 |
Python Completions | 5715 |
Java Completions | 3025 |
CoffeeScript Completions | 19 |
C# Completions | 787 |
Total Stars | 222 |
% of votes with a positive feedback rating | 90% of 2071 |
Total "Very Satisfied" Votes | 1715 |
Total "Somewhat Satisfied" Votes | 294 |
Total "Not Satisfied" Votes | 62 |