Python Forum

Full Version: Homework - Read from/Write to file (renamed from Help help help)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
1. Scenario
An electronic store which sells electronic appliances maintains its inventory in
a text file. An application needs to be developed which will read the text file
and display the products available. Then with each purchase an invoice
should be generated for the particular customer and should be written into a
file. The inventory should also be updated with each purchase. For example,
if the store had 30 mobile phones available, then if 1 mobile phone is sold the
number should be changed to 29.
A sample format of the text file containing the information about the products
is as follows:
phone,200,30
laptop,900,49
HDD,200,40
The 1st column is the name of the product, 2nd column is the price and the 3rd
column is the number of pieces in stock.
*You can use your own format and add other information too
An invoice should be generated for each purchase and should contain the
name of the customer, the products bought, the discounted amount (if
available), the total purchase amount and the date and time of the purchase.
Each invoice should have a unique name and should be written to file. The
format of the invoice is up to you.
No question?
What have you tried?
Show us the code in proper tags. Show us the errors if any and tell us what is the issue with your assignment. I presume that this is a homework.