Steven wants to build a very simple tip calculator for whenever he goes eating in a restaurant.
Fantastic news! We've Found the answer you've been seeking!
Question:
Steven wants to build a very simple tip calculator for whenever he goes eating in a restaurant. In his country, it's usual to tip 25% if the bill value is between 90 and 500. If the value is different, the tip is 30%. 1. Your task is to calculate the tip, depending on the bill value. Create a variable called 'tip' for this. It's not allowed to use an if/else statement (If it's easier for you, you can start with an if/else statement, and then try to convert it to a ternary operator!) 2. Print a string to the console containing the bill value, the tip, and the final value (bill + tip). TEST DATA: Test for bill values 600, 400 and 430
Related Book For
Business Statistics Communicating With Numbers
ISBN: 9780078020551
2nd Edition
Authors: Sanjiv Jaggia, Alison Kelly
Posted Date: