he program then creates the bill and saves it in output file. The o ill_ where xx is the name of order file. An example of the bill File Samples below. al Requirements: ou should use functions to perform common tasks. For example, to re ne from an input file, to write a line to an output file, to perform comm -- elc.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
4. bill sultan.txt (output file for sultan's bill)
SN
ITEM
QTY U.PRICE
AMOUNT
1
Apples
Cherries
3.5
10.50
25.00
36.75
50.00
4
6
Donuts
Flowers
HP_Ink
Icecream
5
10.00
15.00
50.00
60.00
2
1
30
150.00
50.00
2.50
300.00
50.00
75.00
Eggs
JavaCoffee
10
11
3
2
250.00
350.00
750.00
700.00
Zafron
Sale Total.... 2071.75
Discount....
400.00
Total Amount.. 1671.75
VAT 15%....
Grand Total... 1922.51
250.76
What to submit?
1. Create an order file similar to sultan.bxt, and save it as your name.
2. Test your code using the provided input files and the one you create, and confirm the
output. Take screenshots of the output files, input files you made, and your code, put
them all in one pdr document.
3. Submit one zipped file containing the following:
your code (in ipynb file),
your input and output files (in txt files),
and the pdf document prepared in step 2.
m254 21332
Transcribed Image Text:4. bill sultan.txt (output file for sultan's bill) SN ITEM QTY U.PRICE AMOUNT 1 Apples Cherries 3.5 10.50 25.00 36.75 50.00 4 6 Donuts Flowers HP_Ink Icecream 5 10.00 15.00 50.00 60.00 2 1 30 150.00 50.00 2.50 300.00 50.00 75.00 Eggs JavaCoffee 10 11 3 2 250.00 350.00 750.00 700.00 Zafron Sale Total.... 2071.75 Discount.... 400.00 Total Amount.. 1671.75 VAT 15%.... Grand Total... 1922.51 250.76 What to submit? 1. Create an order file similar to sultan.bxt, and save it as your name. 2. Test your code using the provided input files and the one you create, and confirm the output. Take screenshots of the output files, input files you made, and your code, put them all in one pdr document. 3. Submit one zipped file containing the following: your code (in ipynb file), your input and output files (in txt files), and the pdf document prepared in step 2. m254 21332
In this project, you will write a Python program that generates a bill for some store. The store
owner provides two text files as an input. The program first reads the input file named
"items.txt" which contains a list of all items in the store with their unit-prices. The program
stores the items in in one list called itemList according to their order given in the items.Ixt file.
The index of each item in this list is used as a serial number (S/N) of the item. Then the program
reads the other input file named "promo.txt" which contains the information about special
discounts for promo items. When a customer places an order, a text file is created where each
lines has the item S/N and the quantity. The program then generates a bill for the customer using
the information stored in the itemList.
Input File Format:
1. Input file (items.txt): each line in this file contains the item name followed by its price.
2. Input file (promo.txt): a list of item S/N for all items on promo.
3. Order file: each line in this file contains the item S/N followed by the quantity.
Samples of these input files are given below. (See File Samples).
Main Requirements:
1. When it is started, the program reads the items.Ixt file, and stores the data in one list
named itemlist. Each entry in this list has three parts: itemName, itemPrice, and
itemType. Both the name and the price are given in the items.txt file. The itemType is
either S for standard items (by default) or P for promo items (updated next in Step 2).
2.
The program then reads the promo.txt files, and for each item S/N in the file, it updates
the type of that item in the list to (P).
3. The program then prompts the user to enter the order file name.
• Please enter the order file name (or Q to quit):
• When the user types the order file name, the program processes the order to
generate the bill.
program will keep prompting for new orders and generating bills until the
user hit Q to quit.
4. The program should compute the amount of each item in the order according to its unit
price and quantity. Then it adds up all the amounts and finds the total. It applies discounts
if any. Then, it adds the 15% VAT and find the grand total.
5. There are two kinds of discount in this store.
• For Promo items, apply BOGO (buy-one-get-one free).
• If the total amount (excluding VAT and promo items) is more than SAR 1000, the
store will give one of the purchased items for free. So, the program should deduct
the price of one unit of the most expensive item included in the order.
All discounted amounts are added up, and only the total of the discount will be
shown in the bill and deducted from the grand total before applying the VAT.
6. The program then creates the bill and saves it in output file. The output file name is
bill_XXXX where xXXx is the name of order file. An example of the bill output file is given
in File Samples below.
Technical Requirements:
1. You should use functions to perform common tasks. For example, to read and process a
line from an input file, to write a line to an output file, to perform common computations,
--- ete.
2. The program should be well-documented.
3. The output format should be similar to the ones given in the sample files.
Sample Files: (you can copy/paste and save below data as text file for input)
1. items.txI
Apples
10.50
Bananas
Cherries
12.25
25.00
10.00
Donuts
Eggs
Flowers
2.50
15.00
Grapes
HP_Ink
Icecream
20.00
150.00
50.00
Javacoffee
Zafron
250.00
350.00
2. promo.txt (Donuts and Flowers are on promo this month)
3. sultan.txt (input file for sultan's order)
1
3.5
2.0
4
5.0
4
2
1
9
30
10
11
2
Transcribed Image Text:In this project, you will write a Python program that generates a bill for some store. The store owner provides two text files as an input. The program first reads the input file named "items.txt" which contains a list of all items in the store with their unit-prices. The program stores the items in in one list called itemList according to their order given in the items.Ixt file. The index of each item in this list is used as a serial number (S/N) of the item. Then the program reads the other input file named "promo.txt" which contains the information about special discounts for promo items. When a customer places an order, a text file is created where each lines has the item S/N and the quantity. The program then generates a bill for the customer using the information stored in the itemList. Input File Format: 1. Input file (items.txt): each line in this file contains the item name followed by its price. 2. Input file (promo.txt): a list of item S/N for all items on promo. 3. Order file: each line in this file contains the item S/N followed by the quantity. Samples of these input files are given below. (See File Samples). Main Requirements: 1. When it is started, the program reads the items.Ixt file, and stores the data in one list named itemlist. Each entry in this list has three parts: itemName, itemPrice, and itemType. Both the name and the price are given in the items.txt file. The itemType is either S for standard items (by default) or P for promo items (updated next in Step 2). 2. The program then reads the promo.txt files, and for each item S/N in the file, it updates the type of that item in the list to (P). 3. The program then prompts the user to enter the order file name. • Please enter the order file name (or Q to quit): • When the user types the order file name, the program processes the order to generate the bill. program will keep prompting for new orders and generating bills until the user hit Q to quit. 4. The program should compute the amount of each item in the order according to its unit price and quantity. Then it adds up all the amounts and finds the total. It applies discounts if any. Then, it adds the 15% VAT and find the grand total. 5. There are two kinds of discount in this store. • For Promo items, apply BOGO (buy-one-get-one free). • If the total amount (excluding VAT and promo items) is more than SAR 1000, the store will give one of the purchased items for free. So, the program should deduct the price of one unit of the most expensive item included in the order. All discounted amounts are added up, and only the total of the discount will be shown in the bill and deducted from the grand total before applying the VAT. 6. The program then creates the bill and saves it in output file. The output file name is bill_XXXX where xXXx is the name of order file. An example of the bill output file is given in File Samples below. Technical Requirements: 1. You should use functions to perform common tasks. For example, to read and process a line from an input file, to write a line to an output file, to perform common computations, --- ete. 2. The program should be well-documented. 3. The output format should be similar to the ones given in the sample files. Sample Files: (you can copy/paste and save below data as text file for input) 1. items.txI Apples 10.50 Bananas Cherries 12.25 25.00 10.00 Donuts Eggs Flowers 2.50 15.00 Grapes HP_Ink Icecream 20.00 150.00 50.00 Javacoffee Zafron 250.00 350.00 2. promo.txt (Donuts and Flowers are on promo this month) 3. sultan.txt (input file for sultan's order) 1 3.5 2.0 4 5.0 4 2 1 9 30 10 11 2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education