Answered step by step
Verified Expert Solution
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 RestaurantsRUs
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 Number of AdultsNumber of Children
B cost of most expensive meal if cheapestMeal mostExpensiveMeal
otherwise square root of mostExpensiveMeal cheapestMeal
of total dining bill if number of sodas consumed was more than the total
number of adults plus children, otherwise of total bill
Figure : Tip Formula note that and are exponents
Your manager has asked you write a python program that implements this algorithm. Because RestaurantsRUs 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 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 $ The output $ is incorrect, as is $
Three sample invocations of a program that implements the algorithm are shown below.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started