• API
• FAQ
• Tools
• Archive
daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. # Project:      LAB: 3 (QuinnElijahLab03Sec02Ver01.py)
2. # Name:         Elijah Quinn
3. # Date:         10/12/17
4. # Description:  This program is composed of two programs.
5. #               Program A calculates the cost of an order for
6. #               coffee from the Konditorei coffee shop.
7. #
8. #               Program B calculates how much the user needs to contribute
9. #               to a savings account, on a monthly basis, so they can
10. #               retire at age 68 with \$1,125,000.
11.
12.
13.
14. #Chooses the program. This should be run first.
15. def ChooseProgram():
16.
17.     #Describe the program.
18.     print("This program is composed of two programs. Which one would you like to use?")
19.     print("Type \'coffee\' for a program that calculates the cost of an order for coffee from the Konditorei coffee shop")
20.     print("Type \'savings\' for a program that calculates how much you need to contribute to a savings account, on a monthly basis, so that you can retire at age 68 with \$1,125,000.")
21.
22.     #Take input and place it in strProgramName.
23.     strProgramName = str(input(">>> "))
24.
25.     #strProgramUserWants = ""
26.
27.     #Evaluate the input.
28.     #lower() converts a string to lowercase.
29.
30.
31.     if(strProgramName.lower() == "coffee"):
32.         CoffeeProgram()
33.         #strProgramUserWants == "coffee"
34.
35.     if(strProgramName.lower() == "savings"):
36.         SavingsProgram()
37.         #strProgramUserWants == "savings"
38.
39.     else:
40.         print("Program ended.")
41.
42.
43. #the Coffee Program
44. def CoffeeProgram():
45.
46.     #Ask user how many pounds of coffee they want.
47.     fltPounds = float(input("Enter how many pounds of coffee you want:"))
48.
49.     #Shipping is (0.86 * pounds / 100) + \$1.50
50.     fltShippingCost = 1.50 + (fltPounds * 0.86)
51.
52.     #Coffee costs 10.50 a pound + cost of shipping.
53.     fltCoffeePrice = (10.50 * fltPounds) + fltShippingCost
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top