Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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%

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres a solution using a ternary ope... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Statistics Communicating With Numbers

Authors: Sanjiv Jaggia, Alison Kelly

2nd Edition

0078020557, 978-0078020551

More Books

Students also viewed these Programming questions

Question

Explain limitations on confidentiality inherent in group therapy.

Answered: 1 week ago

Question

How is this person feeling about the situation?

Answered: 1 week ago