Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Project: LAB: 3 (QuinnElijahLab03Sec02Ver01.py)
- # Name: Elijah Quinn
- # Date: 10/12/17
- # Description: This program is composed of two programs.
- # Program A calculates the cost of an order for
- # coffee from the Konditorei coffee shop.
- #
- # Program B calculates how much the user needs to contribute
- # to a savings account, on a monthly basis, so they can
- # retire at age 68 with $1,125,000.
- #Chooses the program. This should be run first.
- def ChooseProgram():
- #Describe the program.
- print("This program is composed of two programs. Which one would you like to use?")
- print("Type \'coffee\' for a program that calculates the cost of an order for coffee from the Konditorei coffee shop")
- 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.")
- #Take input and place it in strProgramName.
- strProgramName = str(input(">>> "))
- #strProgramUserWants = ""
- #Evaluate the input.
- #lower() converts a string to lowercase.
- if(strProgramName.lower() == "coffee"):
- CoffeeProgram()
- #strProgramUserWants == "coffee"
- if(strProgramName.lower() == "savings"):
- SavingsProgram()
- #strProgramUserWants == "savings"
- else:
- print("Program ended.")
- #the Coffee Program
- def CoffeeProgram():
- #Ask user how many pounds of coffee they want.
- fltPounds = float(input("Enter how many pounds of coffee you want:"))
- #Shipping is (0.86 * pounds / 100) + $1.50
- fltShippingCost = 1.50 + (fltPounds * 0.86)
- #Coffee costs 10.50 a pound + cost of shipping.
- fltCoffeePrice = (10.50 * fltPounds) + fltShippingCost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement