Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this coding task, assume you are a software engineer for the company Restaurants - R - Us . A new client has been acquired,

For this coding task, assume you are a software engineer for the company Restaurants-R-Us.
A new client has been acquired, and that restaurant has decided to modify its business model by requiring a tip that is calculated using a simple algorithm. You think it's a ridiculous idea that a tip should be required, but you are willing to go along with your boss's wishes and develop a python program that implements such an algorithm.
Required Tip=A+B+C
A = Number of Adults)^1.4+(Number of Children)^0.8
B = cost of most expensive meal if (cheapestMeal mostExpensiveMeal/2),
otherwise square root of (mostExpensiveMeal - cheapestMeal)
C=10% of total dining bill if number of sodas consumed was more than the total
number of adults plus children, otherwise 15% of total bill
Figure 3: Tip Formula - note that 1.4 and 0.8 are exponents
Your manager has asked you write a python program that implements this algorithm. Because RestaurantsR-Us is a software development company that follows good practices, the following rules are also being imposed on your program:
Your program file must be called tipCalculator.py
You program must have a main() function
You must define separate custom functions for portions A, B and C of the algorithm
You should at a minimum include a fourth custom function, named calcTip
The main() function can invoke any of the standard functions available in python (int (), input (), print (), etc.), but can invoke just a single of your custom functions.
The main() function should be at most 15 lines of code (it can be coded in far fewer)
The program must prompt the user for the inputs needed to perform the required tip calculation
The output of your program should provide a tip amount in the form of dollars and cents,
for example $14.33. The output $22.5 is incorrect, as is $15.
Three sample invocations of a program that implements the algorithm are shown below.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions

Question

If t(x) x/e x , find g (n) (x).

Answered: 1 week ago

Question

Types of physical Maps?

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

7. Identify six intercultural communication dialectics.

Answered: 1 week ago