import promotion
import starbuzz

from transactions import *

items = ["DONUT", "LATTE", "FILTER", "MUFFIN"]
prices = [1.50, 2.0, 1.80, 1.20]
running = True

while running:
    option = 1
    for choice in items:
        print(str(option) + " " + choice)
        option += 1
    print(str(option) + ". Quit")
    choice = int(input("Choose an option: "))
    if choice == option:
        running = False
    else:
        credit_card = int(input("Credit card number: "))
        price = promotion.discount(prices[choice - 1])
        if input("Starbuzz card? ") == "Y":
            price = starbuzz.discount(price)
        save_transactions(price, credit_card, items[choice - 1])
from transactions import *
import promotion
import starbuzz

items = ["DONUT", "LATTE", "FILTER", "MUFFIN"]
prices = [1.50, 2.0, 1.80, 1.20]
running = True
while running:
    option = 1
    for choice in items:
        print(str(option) + ". " + choice)
        option = option + 1
    print(str(option) + ". Quit")
    choice = int(input("Choose an option: "))
    if choice == option:
        running = False
    else:
        credit_card = input("Credit Card Number: ")
        price=promotion.discount(prices[choice - 1])
        if input("Starbuzz Card?") == "Y" :
            price = starbuzz.discount(price)
        save_transaction(price, credit_card, items[choice - 1])
示例#3
0
from transactions import *
import promotion
import starbuzz

items = ["DONUT", "LATTE", "FILTER", "MUFFIN"]
prices = [1.50, 2.20, 1.80, 1.20]
running = True

while running:
    option = 1
    for choice in items:
        print(str(option) + "." + choice)
        option = option + 1
    print(str(option) + ". Quit")
    choice = int(input("Choose an option: "))
    if choice == option:
        running = False
    else:
        credit_card = input("Credit card number: ")
        new_price = promotion.discount(prices[choice - 1])
        if input("Starbuzz card?\n") == "Y":
            new_price = starbuzz.discount(prices[choice - 1])
        save_transaction(new_price, credit_card, items[choice - 1])
示例#4
0
from transactions import *
import promotions
import starbuzz

items = ["Salad", "Coffee", "Donuts", "Cereal"]
prices = [1.50, 2.0, 1.80, 1.20]
running = True

while running:
    option = 1
    for choice in items:
        print(str(option) + "." + choice)
        option = option + 1
    print(str(option) + ".Quit")
    choice = int(input("Choose an option: "))
    if choice == option:
        runnning = False
    else:
        creditCard = input("Enter your credit card number: ")
        newPrice = promotions.discount(prices[choice - 1])
        if input("Starbuzz card? ") == "Y":
            newPrice = starbuzz.discount(newPrice)
    saveTransaction(newPrice, creditCard, items[choice - 1])
示例#5
0
from transactions import *  #By importing the transactions module like this, you can call the functions without the module name.
import promotion
#You need to use this kind of import for “promotion.py” and “starbuzz.py”, because you are going to qualify the function names with the module names.
import starbuzz

items = ["DOUNT", "LATTE", "FILTER", "MUFFIN"]
prices = [1.50, 2.0, 1.80, 1.20]
running = True

while running:  #The loop will keep running while the "running" variable has the value True. To end the loop,set "running" to False.
    option = 1
    for choice in items:
        print(str(option) + ". " + choice)
        option = option + 1
    print(str(option) + ". Quit")
    choice = int(input("Choose an option: ")
                 )  #The user inters a menu option number to make a sale.
    if choice == option:  #This will be True if the user selects the LAST option on the menu, which is "Quit".
        running = False
    else:
        credit_card = input("Credit card number: ")
        price = promotion.discount(
            prices[choice - 1])  #Code will call the "discount()" function.
        if input("Starbuzz card? ") == "Y":
            price = starbuzz.discount(
                price
            )  #Id someone has a starbuzz discount card you need to apply the second starbuzz discount.
        save_transaction(price, credit_card, items[choice - 1])
        #"price" is the discount value of the price.
示例#6
0
items = ["DONUT", "LATTE", "FILTER", "MUFFIN"]
prices = [1.50, 2.0, 1.80, 1.20]
running = True
starbuzz_discount = input("Do you have Starbuzz discount card? (Y/N) ")
while running:
    option = 1
    for choice in items:
        print(str(option) + ". " + choice)
        option = option + 1
    print(str(option) + ". Quit")
    choice = int(
        input("Choose an option: "))  #inserisci un numero intero da 1 a 5
    if choice == option:  #cioè è uguale a 5 che corrisponde a quit
        running = False  # chiude il programma
    else:
        credit_card = input(
            "Credit card number: "
        )  # se è una delle 4 precedenti conferma l'acquisto
        if Luhn(int(
                credit_card)) == 1:  #chiamo la funzione Luhn dal modulo luhn
            if starbuzz_discount == "N":
                save_transaction(
                    promotion.discount(prices[choice - 1]), credit_card,
                    items[choice - 1])  #uso la funzione del modulo
            elif starbuzz_discount == "Y":
                save_transaction(
                    starbuzz.discount(promotion.discount(prices[choice - 1])),
                    credit_card, items[choice - 1])
        else:
            running = False  #se il codice non è valido chiude il programma
示例#7
0
import promotion
import starbuzz
from transactions_2 import *
items = ["DONUT", "LATTE", "FILTER", "MUFFIN"]
prices = [1.50, 2.0, 1.80, 1.20]
running=True
starbuzz_discount=input("Do you have Starbuzz discount card? (Y/N) ")
while running:
	option=1
	for choice in items:
		print(str(option) + ". " + choice)
		option=option+1
	print(str(option) + ". Quit")
	choice=int(input("Choose an option: ")) #inserisci un numero intero da 1 a 5
	if choice==option: #cioè è uguale a 5 che corrisponde a quit
		running=False # chiude il programma
	else:
		credit_card=input("Credit card number: ") # se è una delle 4 precedenti conferma l'acquisto
		if starbuzz_discount=="N":
			save_transaction(promotion.discount(prices[choice - 1]), credit_card,items[choice -1] ) #uso la funzione del modulo
		elif starbuzz_discount=="Y":
			save_transaction(starbuzz.discount(promotion.discount(prices[choice - 1])), credit_card,items[choice -1] )
示例#8
0
from transactions import *
import promotion
import starbuzz
items = ["DONUT", "LATTE", "FILTER", "MUFFIN"]
prices = [1.50, 2.20, 1.80, 1.20]
running = True

while running:
    option = 1
    for choice in items:
        print(str(option) + "." + choice)
        option = option + 1
    print(str(option) + ". Quit")
    choice = int(input("Choose an option: "))
    if choice == option:
        running = False
    else:
        credit_card = input("Credit card number: ")
        new_price = promotion.discount(prices[choice - 1])
        if input("Starbuzz card?\n") == "Y":
            new_price = starbuzz.discount(prices[choice - 1])        
        save_transaction(new_price, credit_card, items[choice - 1])