Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# LAMA

Answered Same Day Aug 19, 2020

## Solution

Meenakshi answered on Aug 23 2020
assignmentpython/CheckoutRegister.py
class CheckoutRegister():
def __init__(self,checkout_date,checkout_items):
self.checkout_date = checkout_date
self.checkout_items = checkout_items
self.checkout_items.append(p)

def display_checkout_items(self):
print("Checkout Items")
print(self.checkout_items)
def calculate_payment_due(self):
cart_items = self.checkout_items
cart_totals = 0
for index, product in enumerate(self.checkout_items):
cart_totals += product['price']
self.due = cart_totals
return cart_totals
def pay_money(self,total):
amount_to_pay = total
print("\nPayment due: \$"+str(amount_to_pay))
#self.accept_payment(amount_to_pay)
#amount_to_pay = input("Please enter an amount to pay: ")
change = self.accept_payment(amount_to_pay)
return change

def accept_payment(self, amount_to_pay):
#print("accept payment")
paid = float(0.0)
customer_pay = float(0.0)
due = float(0.0)
total = amount_to_pay
due = True

while due == True:
try:
paid = float(input("\nPlease enter an amount to pay: "))
if(paid < 0.0):
print("We don't accept negative money!\n")
continue
else:
customer_pay += paid
self.customer_pay = customer_pay
if(paid < total):
due = total - paid
total = due
print("Payment due: \$"+str(due))
due = True
continue
else:
change = paid - total
self.change = change
#print("Change: ",change)
return change

eak

eak
#due = False
#self.print_receipt(change)

except ValueE
or:
print('Please enter a valid floating point value.')
return change

def print_receipt(self,change):
print("\n----- Final Receipt -----\n")
for index, item in enumerate(self.checkout_items):
print(item['name'],' \$'+str(item['price']))
print("\n")
print("Total amount due:",' \$'+str(self.due))
print("Change Given",' \$'+str(self.change),'\n')
assignmentpython/main.py
from product import Product
from checkoutregister import CheckoutRegiste
from time import gmtime, strftime
#import sys
import os
import sys
cu
ent_date_time = strftime("%Y-%m-%d %H:%M:%S", gmtime())
wishlist = []
def scan_product():
p1 = Product("","",barcode)
search_product = p1.check_product_on_inventory()
if(search_product == False):
print("This product does not exist in our inventory.\n")
scan_another()
else:
wishlist.append(search_product)
scan_another()

def scan_another():
scan_another = input("Would you like to scan another product? (Y/N)")
if(scan_another == 'y' or scan_another == 'Y'):
scan_product()
def main():
scan_product()
c1 =...
SOLUTION.PDF