Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program, ch 2 _ p 1 . py , that gets a float from the user using the input ( ) function representing

Write a program, ch2_p1.py, that gets a float from the user using the input() function
representing the total of a restaurant bill. Then, calculate a 18%,20%, and 25% tip on the bill as well
as the total amount for each including the tip. Format your output as shown below, including rounding
all floating-point numbers to 2 decimal places and a tab between the tip amount and word Total.
You are trying to make Lemon Drop cocktails, but the recipe is written in ounces and you do not own
a jigger (a cocktail measuring cup that measures in ounces). Write a program, ch2_p2.py, that
converts the recipe from ounces to tablespoons. There are 2 tablespoons in 1 ounce. Then, using the
input() function, ask the user how many cocktails they want to make and adjust the tablespoons
version of the recipe. Finally, print out the adjusted recipe to the user (in tablespoons) for their desired
number of cocktails. Utilize constants to store the ounce amounts of each ingredient as floats.
Write a program, ch2_p3.py, that gets two integers from the user using the input()
function and performs the modulo operation on the two integers without using the mod
operator (%). Use only other math operators (addition, subtraction, division, integer division,
and/or exponent) to calculate the result of the mod operator with the users chosen integers.
Print both your calculation and the calculation using the mod operator for comparison.
SUBMISSION
PROGRAM 2
PROGRAM 3
PROGRAM 1
Submit your ch2_p1.py, ch2_p2.py, and ch2_p3.py files to the
Chapter 2 Homework Programs: Input, Processing, and Output assignment on Canvas.
Enter bill total: $63.85
18%: (Tip $11.49 Total: $75.34)
20%: (Tip $12.77 Total: $76.62)
25%: (Tip $15.96 Total: $79.81)
How many Lemon Drops to make: 2
To make 2 Lemon Drop(s), mix:
*8.0 tbs of vodka
*2.0 tbs of triple sec
*4.0 tbs of lemon juice
*4.0 tbs of simple syrup
Enter first integer: 10
Enter second integer: 3
My Calculation: 10%3=1
Mod Operator Calculation: 10%3=1
EXAMPLE OUTPUT
EXAMPLE OUTPUT
EXAMPLE OUTPUT
ENTER
ENTER
ENTER
ENTER
LEMON DROP RECIPE:
2 ounces of vodka
1/2 ounce of triple sec
1 ounce of lemon juice
1 ounce of simple syrup
Dont worry about negative
values. Assume the user will only
enter positive whole numbers

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

Why is it important to have a code of ethics?

Answered: 1 week ago