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 13:30
Hola, me podrian resolver estos ejercicios en php? ejercicio1: crear una pagina que permita realizar una conversion monteria: nuevos soles, dolares, euros. se debe seleccionar el valor monetario origen y conversion asi como tambien el monto a convertir ejercicio2: crear un pagina que muestre la tabla de sumar de un rango de numeros ingresados por teclado. ejercicio3: ingresar una palabra y mostrar la escritura del final al inicio ejercicio4: ingresar la fecha de nacimiento de una persona y determinar, cuantos años, meses y dias tiene ejercicio5: ingresar un rango de valor numerico y mostrar, los numeros pares, impares y primos.
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
question
Computers and Technology, 22.06.2019 19:50
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called.write a constructor for the above class that initialized both variables to zero.write a tostring to display both the tank and speed when the car is printed.modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter.write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Selling a product through an electronic medium is
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, 06.01.2021 14:00
question
Mathematics, 06.01.2021 14:00
question
History, 06.01.2021 14:00
question
Mathematics, 06.01.2021 14:00
question
Mathematics, 06.01.2021 14:00
question
History, 06.01.2021 14:00
Questions on the website: 13722367