Cash Register

From Wiki of the E-Business and Web Science Research Group
Jump to: navigation, search

Source Code of the Cash Register Demo

# my cash register
# martin hepp, nov 5, 2008
 
EANdatabase = {
'4006067080999':('Feine Milde',4.99),
'40057842':('Thomy Kaese Sahne-Sauce',0.99),
'40056265': ('Thomy Sauce Hollandaise',0.99),
'4006581020006':('Eilles Gourmet-Kaffee',5.99),
'4017100370007':('Leibniz Butterkeks',1.99),
'4062800000990': ('Minus L haltbare Milch laktosefrei',1.19),
'4001726329006':('Koelner Gruemmel Kandis',1.49),
'4005500019305': ('Haribo Fruity SMARTIES',0.69)
}
 
print 'UniBW Munich Point-Of-Sale'
print 'Written by the E-Business & Web Science Research Group'
 
total=0
 
while True:
    ean=raw_input('Enter EAN or scan item')  # fetch EAN from keyboard
    if (ean==''): break             # stop when input is empty
    print ean                       # print EAN
    product = EANdatabase[ean]      # look up product by EAN
    productname =product[0]         # get product name
    price = product[1]              # get price per unit
    print productname, price        # show product name and price
    total=total+price               # add product price to bill
 
print 'Thanks for shopping with us. The total is', total
Personal tools
Navigation