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 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 tried this and nd on the fourth line it is throwing me a "syntax error" but I can't see why as it is the same as "itemQuantity" which didn’t give a syntax error.
salesTotal = 0 itemName = input("Please enter the item name: ")
itemQuantity = int(input("Please enter the quantity of the item purchased: ")
itemPrice = int(input("Please enter the price of the item purchased: ")
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_quantity
sales_total=sales_total+Extender_price
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_quantity)+","+str(Item_price)+","+str(Extender_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_quantity
sales_total=sales_total+Extender_price
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_quantity)+","+str(Item_price)+","+str(Extender_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_value
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_value
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)
This question is for Python 3. I can get the first couple of steps in this...
I need help building code in python for this: 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...
I need a shoppingcartmanager.java that contains a main method for this code in java Itemtopurchase.java public class ItemToPurchase { // instance variables private String itemName; private String itemDescription; private int itemPrice; private int itemQuantity; // default constructor public ItemToPurchase() { this.itemName = "none"; this.itemDescription = "none"; this.itemPrice = 0; this.itemQuantity = 0; } public ItemToPurchase(String itemName, int itemPrice, int itemQuantity,String itemDescription) { ...
I am writing a console application in C#. It is a receipt where the user inputs the item then quantity and then price per item. It is then validated through regular expressions. I need to put this in a multidimensional array to print out (command line print), like each row would have a columns for item, quantity, price and then subtotal for each item, but cannot figure it out. I also need the regular expression in a do while loop...
Need three seperate files. ShoppingCartManager.java
ShoppingCart.java
ItemsToPurchase.java
These are from part 1
what do you mean by deep study
7.25 LAB*: Program: Online shopping cart (Part 2) Note: Creating multiple Scanner objects for the same input stream yields unexpected behavior. Thus, good practice is to use a single Scanner object for reading input from System.in. That Scanner object can be passed as an argument to any methods that read input This program extends the earlier Online shopping cart program (Consider...
8.6 LAB*: Warm up: Online shopping cart (Part 1)(1) Create two files to submit:ItemToPurchase.java - Class definitionShoppingCartPrinter.java - Contains main() methodBuild the ItemToPurchase class with the following specifications:Private fieldsString itemName - Initialized in default constructor to "none"int itemPrice - Initialized in default constructor to 0int itemQuantity - Initialized in default constructor to 0Default constructorPublic member methods (mutators & accessors)setName() & getName() (2 pts)setPrice() & getPrice() (2 pts)setQuantity() & getQuantity() (2 pts)(2) In main(), prompt the user for two items and create...
CODES: main.cpp #include <iostream> #include <string> #include "ShoppingCart.h" using namespace std; char PrintMenu() { char answer; cout << "MENU" << endl; cout << "a - Add item to cart" << endl; cout << "d - Remove item from cart" << endl; cout << "c - Change item quantity" << endl; cout << "i - Output items' descriptions" << endl; cout << "o - Output shopping cart" << endl; cout << "q - Quit" << endl << endl; while (true) {...
Ch 7 Program: Online shopping cart (continued) (Java)This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program).(1) Extend the ItemToPurchase class per the following specifications:Private fieldsstring itemDescription - Initialized in default constructor to "none"Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt)Public member methodssetDescription() mutator & getDescription() accessor (2 pts)printItemCost() - Outputs the item name followed by the quantity, price, and subtotalprintItemDescription() - Outputs the...
Please use C Programming language (Not C++)
7.6 LAB*: Warm up: Online shopping cart (Part 1) (1) Create three files to submit: • Item ToPurchase.h - Struct definition and related function declarations • Item ToPurchase.c-Related function definitions • main.c-main function Build the ItemToPurchase struct with the following specifications: • Data members (3 pts) • char itemName • int itemPrice • int itemQuantity • Related functions • MakeltemBlank0 (2 pts) Has a pointer to an item To Purchase parameter. Sets item's...
I need help with this assignment, can someone HELP ? This is the assignment: Online shopping cart (continued) (C++) This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the ItemToPurchase class per the following specifications: Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt) Public member functions SetDescription() mutator & GetDescription() accessor (2 pts) PrintItemCost() - Outputs the item name followed by...
20.1 LAB*: Warm up: Online shopping cart (Part 1) in C++ Please: The answers are already on chegg are not working. (1) Create three files to submit: ItemToPurchase.h - Class declaration ItemToPurchase.cpp - Class definition main.cpp - main() function Build the ItemToPurchase class with the following specifications: Default constructor Public class functions (mutators & accessors) SetName() & GetName() (2 pts) SetPrice() & GetPrice() (2 pts) SetQuantity() & GetQuantity() (2 pts) Private data members string itemName - Initialized in default constructor...