I need help building code in python for this:
Create a program that:
#Main function
def main():
#Empty list
l=[]
#taking inputs from user
name=input("Enter item name:")
quantity=int(input("Enter item quantity:"))
price=float(input("Enter item price:"))
#Printing all details of item
print("name= ",name)
print("Quantity= ",quantity)
print("Price= ",price)
#Calculating and displaying extended price=quantity*price
e=quantity*price
#storing extended price of each item in list
l.append(e)
print("Extended price= ",e)
#Taking name of the file as input from user
f_name=input("Enter the filename in which you want to save
data...")
#opening that file in write mode as calculation is done only on the
item
# stored in one execution of program
file=open("{}.txt".format(f_name),'w')
#While loop
while(1):
#Storing all the details of item in that file with , in
between
file.write(name+",")
file.write(str(quantity)+",")
file.write(str(price)+",")
file.write(str(e)+"\n")
#Asking user if they wants to add more items
i=input("Do you want to add more items?(y/n)")
#if yes then again take input of all details of the items and
#storing it in file in next iteration of loop as the loop
continues
if(i=="y" or i=="Y"):
name=input("Enter item name:")
quantity=int(input("Enter item quantity:"))
price=float(input("Enter item price:"))
print("name= ",name)
print("Quantity= ",quantity)
print("Price= ",price)
e=quantity*price
l.append(e)
print("Extended price= ",e)
#otherwise close the file and come out of loop
elif(i=="n" or i=="N"):
file.close()
break
#Printing total sales stored in that list l
print("Sales total= ",sum(l))
#if total sales >$100
if(sum(l)>100):
a=sum(l)
#10% discount
dis=a/10
#sales after discount
sales=a-dis
#printing discount
print("Discount= ",dis)
#8% sales tax on the sale after discount
sales_tax=sales*8/100
#printing sales tax
print("Sales Tax= ",sales_tax)
#Total sale after discount and sales tax addition
s=sales+sales_tax
#Displaying final sales
print("Total sales after discount and sales tax addition =
",s)
#calling main function
main()




I need help building code in python for this: Create a program that: Creates a sales...
This question is for Python 3. I can get the first couple of steps in this question but I get errors. 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...
I need a code summary for these problems Sale Total Create a Visual C# Windows Console Application that will prompt the user to enter what type of item they are purchasing, the quantity of the item, and the price for the item. Calculate the subtotal, the sales tax and the sales total (subtotal + sales tax) and output all 3 to the user. Assume that the sales tax for your application is 8.5% (create a constant to store this value...
PYTHON CODING HELP: BELOW ARE THE STEPS I NEED HELP WITH PLEASE. :) First create a text file named "items.txt" that has the following data in this order: Potatoes Tomatoes Carrots ... and have it be in the same directory as the Python program you are coding for this assignment. IMPORTANT: Your program should work with any size file. It should work with 100 items listed or with no items in the file! Write a Python program that ... 1....
Write in C# Programming Language. - count =0; - Create a 2d array "items". string[,] items = new string[100, 4]; - Create a do while loop, when user enter "0", stop the loop. - User enter item name, price, quantity, save these info and subtotal to array. - increase "count++" -conver price(decimal, Convert.ToDecimal() ) and quantity(int) to do mulplication for subtotal - create a for loop (with count ) to cycle through the "items", display item name, price, quantity, and...
Java I: Create a Java program that will accept the price of an item and the quantity being purchased of that item. After accepting the input, calculate the amount of the purchase (based on the price and quantity), calculate the sales tax on the purchase, then output the product price, quantity, subtotal, sales tax, and the total sale based on the output format shown below. Structure your file name and class name on the following pattern: The first three letters...
Python 3.6
i need the code ready to copy and run with adequate
indentation
Write a program that will calculate the cost of purchasing a meal. This program will include decisions and loops. Details of the program are as follows: Your menu items only include the following food with the accompanying price: Yum Yum Burger =.99 Grease Yum Fries =.79 Soda Yum = 1.09 Allow the user of the program to purchase any quantity of these items in one order....
For Python-3 I need help with First creating a text file named "items.txt" that has the following data in this order: Potatoes Tomatoes Carrots. Write a python program that 1. Puts this as the first line... import os 2. Creates an empty list 3. Defines main() function that performs the tasks listed below when called. 4. Put these two lines at the top of the main function... if os.path.exists("costlist.txt"): os.remove("costlist.txt") Note: This removes the "costlist.txt" file, if it exists. 5....
Use java and continue stage 2 and 3
stage 1 code
public abstract class BabyItem {
protected String name;
public BabyItem() {
name="";
}
public BabyItem(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
}
public abstract double getCost();
}
========================================================================================
public class BabyFood extends BabyItem {
private int numberOfJars;
private double pricePerDozen;
public BabyFood() {
super();
numberOfJars = 0;
pricePerDozen = 0;
}
public BabyFood(int numberOfJars, double pricePerDozen) {...
Create a Java program application that creates an ArrayList that holds String objects. It needs to prompt the user to enter the names of friends, which are then put into the ArrayList; allow the user to keep adding names until they enter "q" to quit. After input is complete, display a numbered list of all friends in the list and prompt the user to enter the number of the friend they wish to delete. After deleting that entry, output the...
I need help with one small part of the following question. I think I know how to do all the things the question is asking I just can’t figure out how to get it to open the text file. I tried Filename =input “vacation.txt” but that didn’t open the file. Does the program have to direct it to "find" the program? HERE IS THE COMPLETE QUESTION: Create a Python program that: Opens a file and reads the contents of the...