subject

Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file When you create the file, prompt the user for the name they want to give the file Separate the items saved with commas Each entry should be on a separate line in the text file Ask the user if they have more items to enter Once the user has finished entering items Close the file with the items entered Display the sales total If the sales total is more than $100 Calculate and display a 10% discount Calculate and display the sales tax using 8% as the sales tax rate The sales tax should be calculated on the sales total after the discount Display the total for the sales receipt, I thought this would work (see below) but I keep getting errors:sales_total=0 Item_name=input("Enter the item name: ") Item_quantity=int(input("Enter the item quantity: ")) Item_price=int(input("Enter the item price $: ")) Extender_price=Item_price*Item_quan tity sales_total=sales_total+Extender_pr ice print("\nItem name:{}".format(Item_name)) print("Item quantity:{}".format(Item_quantity)) print("Item price:${}".format(Item_price)) print("Extended price:${}".format(Extender_price)) filename=input("Enter the filename:") f=open(filename+".txt","a+") #writing the values to file f. write((Item_name)+","+str(Item_quan tity)+","+str(Item_price)+","+str(E xtender_price)+"\n") while(True): option=input("Do you want to enter more items(Yes/No)?") if option. lower()=="yes": Item_name=input("Enter the item name: ") Item_quantity=int(input("Enter the item quantity: ")) Item_price=int(input("Enter the item price: ")) Extender_price=Item_price*Item_quan tity sales_total=sales_total+Extender_pr ice print("\nItem name:{}".format(Item_name)) print("Item quantity:{}".format(Item_quantity)) print("Item price:${}".format(Item_price)) print("Extended price:${}".format(Extender_price)) f. write((Item_name)+","+str(Item_quan tity)+","+str(Item_price)+","+str(E xtender_price)+"\n")#writing them to the file f. close() #closing the file else: break sales_tax=8 if sales_total>100: discount_value=sales_total*(10/100) sales_total=sales_total-discount_va lue tax=sales_total*(sales_tax/100) total=sales_total-tax print("Discount:\t-",discount_value ) print("Sales tax:\t+",tax) print("After sales tax applied:",total) else: sales_total=sales_total-discount_va lue tax=sales_total*(sales_tax/100) total=sales_total-tax print("Discount:\t-",discount_value ) print("Sales tax:\t+",tax) print("After sales tax applied:",total)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:00
Which of the following is a true statement about milestones
Answers: 1
question
Computers and Technology, 22.06.2019 08:00
Someone with this coz i don’t really know what i can choose, just pick whatever u want. homework - you need to choose a website that you like or use frequently. you must visit the website and discuss 6 different features/parts/aspects of the website that you think makes it good. (100 words)
Answers: 2
question
Computers and Technology, 22.06.2019 09:00
Designing a mobile web page is a little different from designing a regular web page. name at least three features that should be considered when designing a website that is mobile phone-friendly, and briefly explain why they are important.
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
Which of the following statements tests if students have a grade of 70 or above, as well as fewer than five absences? a: if(grade > = 70 and daysabsent < = 5): b: if(grade > = 70 or daysabsent < = 5): c: if(grade > 70 and daysabsent < = 5): d: if(grade > 70 or daysabsent < = 5): i took the test the answer is a
Answers: 1
You know the right answer?
Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves t...
Questions
question
Mathematics, 30.09.2019 11:50
question
Mathematics, 30.09.2019 11:50
question
World Languages, 30.09.2019 11:50
Questions on the website: 13722360