0% found this document useful (0 votes)
5 views16 pages

Python CBP

The 'Canteen Bill' project is a Python-based billing system designed for educational institutes, consisting of two main modules: 'canteen.py' for user interaction and bill generation, and 'menu.py' for displaying menu items. The system allows users to select food items, specify quantities, calculate total costs, and save bills to a text file, enhancing the ordering experience in canteens. This project serves as a practical tool for managing canteen orders and is applicable in various dining establishments and food services.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views16 pages

Python CBP

The 'Canteen Bill' project is a Python-based billing system designed for educational institutes, consisting of two main modules: 'canteen.py' for user interaction and bill generation, and 'menu.py' for displaying menu items. The system allows users to select food items, specify quantities, calculate total costs, and save bills to a text file, enhancing the ordering experience in canteens. This project serves as a practical tool for managing canteen orders and is applicable in various dining establishments and food services.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

A Course based project report on

CANTEEN BILL
submitted

for

partial fulfilment of requirements for the PYTHON lab course of

I year CSE-D

Of

VNRVJIET

by

1.P.ABHISHEK -22071A05T1
2.S.DIVYA SRI -22071A05R3
3.V.VARAPRASAD -22071A05T3
4.Y.SRI VAISHNAVI -22071A05T4

Department of Computer Science And Engineering

VNR Vignana Jyothi Institute of Engineering and


Technology – Hyderabad

2022-23
1
A Project Report On

CANTEEN BILL
submitted

in

partial fulfilment of requirements

for the completion of

PYTHON laboratory course

B-TECH Computer Science Engineering

Of

VNRVJIET

2022-2023

Under the Guidance of


P.VIJAY BHASKHAR
ASSISTANT PROFESSOR
CSE DEPARTMENT

2
VNR Vignana Jyothi Institute of Engineering and Technology
Department of CSE

Certificate of course project

This is to certify that the project entitled “CANTEEN BILL” submitted in partial
fulfilment for the course of Python Laboratory being offered for the award of
B.Tech (Computer Science and Engineering) by VNR VJIET is a result of the
bonafide work carried out by 22071A05Q2,22071A05R3,22071A05T3
and 22071A05T4 during the year 2022-2023. This has not been submitted
for any other certificate or course.

Signature of Student Signature of faculty


(Guided the project)

Date: Signature of Head of the Department

3
ACKNOWLEDGEMENT

An endeavor over a long period can be successful only with


the advice and support of many well-wishers. We take this
opportunity to express our gratitude and appreciation to all of
them.
We wish to express our profound gratitude to our honorable Principal
and HOD, CSE department, VNR Vignana Jyothi Institute of Engineering and
Technology for their constant and dedicated support towards our career
moulding and development.

With a great pleasure we express our gratitude to the internal


guide, P.Vijay bhaskhar assistant Professor, CSE department for his
timely help, constant guidance, cooperation, support and
encouragement throughout this project as it has urged us to explore
many new things.

Finally, we wish to express my deep sense of gratitude and


sincere thanks to our parents, friends and all our well-wishers who
have technically and non-technically contributed for the successful
completion of this course-based project.

4
DECLARATION

We hereby declare that this Project Report titled “CANTEEN BILL” submitted
by us of Computer Science & Engineering in VNR Vignana Jyothi Institute of
Engineering and Technology, is a bonafide work under taken by us and it is
not submitted for any other certificate /Course or published any time before.

Signature of the Student:

22071A05P0 – P. Abhishek

22071A05P0 – S. Divya Sri

22071A05T3 – V.Varaprasad

22071A05P0 – Y. Sri Vaishnavi

5
INDEX

S.NO TOPIC PAGE


1 7
ABSTRACT
8
2 INTRODUCTION

3 IMPLEMENTATION 9-12

4 RESULTS 13-14

5 APPLICATIONS 15-16

6 REFERENCES 16

6
ABSTRACT

The "Canteen Bill" project is a Python-based canteen billing system


designed for an educational institute. The project consists of two
modules: "canteen.py" and "menu.py."
The "canteen.py" module orchestrates the interaction between users
and the canteen menu, allowing them to select items, specify
quantities, generate bills, and save bill details to a file. The module
provides functionalities for calculating the total cost of selected items
and printing both present and historical bills.
The "menu.py" module defines the menu items available in the
canteen. It includes a MENU dictionary with unique item IDs, names,
and prices for each menu item. The "display_menu()" function formats
and presents the canteen menu to users, displaying item IDs, names,
and prices in a clear and organized manner.
The project focuses on user-friendly interaction, displaying a well-
organized menu and allowing users to select items using their IDs.
Users can choose the quantity of each item they want to order. The
system calculates the total cost based on the selected items and
quantities.
The billing information is saved to a text file named "canteen_bill.txt,"
and users are given the option to print all bills stored in the file.
Overall, the "Canteen Bill" project provides an efficient and user-
friendly solution for managing canteen orders and generating bills
within an educational institute environment. It serves as a practical tool
for students and staff to conveniently order and enjoy food items from
the canteen menu.

7
INTRODUCTION

Welcome to the documentation for the "Canteen Bill" project, a Python-based


canteen billing system tailored for educational institutes. This project offers a user-
friendly and efficient solution for managing canteen orders and generating bills
within the educational environment.
As canteens play an essential role in catering to the needs of students and staff, an
effective billing system becomes crucial to streamline the ordering process. The
"Canteen Bill" project addresses this need by providing an intuitive interface for
selecting items from a menu, specifying quantities, calculating total costs, and
generating bills. With the ability to save and review bills, this project aims to
enhance the canteen experience for all stakeholders.
The project is organized into two modules: "canteen.py" and "menu.py." The
"canteen.py" module handles user interactions, bill calculations, and bill printing.
On the other hand, the "menu.py" module defines the menu items available in the
canteen and displays them in an organized format. This documentation serves as a
comprehensive guide to understanding, implementing, and customizing the
"Canteen Bill" project.
Whether you are a developer looking to extend its features or an educational
institution seeking to optimize canteen operations, this documentation will provide
insights into the project's architecture, functionalities, and potential use cases. Let's
delve into the details of the
"Canteen Bill" project and explore how it can serve as an efficient tool for
managing canteen orders and billing within an educational setting.

8
IMPLEMENTATION OF CANTEEN BILL:
# menu.py

MENU = {
'1': {'name': 'Burger', 'price': 3.50},
'2': {'name': 'Pizza', 'price': 4.00},
'3': {'name': 'Pasta', 'price': 2.50},
'4': {'name': 'Sandwich', 'price': 2.00},
'5': {'name': 'French Fries', 'price': 1.50},
}

def display_menu():
print("Menu:")
print("Item ID\t\tItem Name\t\tPrice")
print("----------------------------------------")
for item_id, item_info in MENU.items():
print(f"{item_id}\t\t{item_info['name']}\t\t${item_info['price']}")
print("----------------------------------------")

# canteen.py

from menu import MENU


from menu import display_menu

def calculate_total(items):
total = 0
for item in items:
total += item['price'] * item['quantity']
return total

def print_bill_to_file(items, total, filename):


with open(filename, 'a') as file: # Use 'a' to append to the file instead of overwriting
file.write("************* Canteen Bill *************\n")
file.write("Item\t\tQuantity\tPrice\n")
file.write("----------------------------------------\n")
9
for item in items:
file.write(f"{item['name']}\t\t{item['quantity']}\t\t{item['price'] *
item['quantity']}\n")
file.write("----------------------------------------\n")
file.write(f"Total:\t\t\t\t{total}\n")
file.write("***************************************\n")

def print_present_bill(items, total):


print("************* Canteen Bill *************")
print("Item\t\tQuantity\tPrice")
print("----------------------------------------")
for item in items:
print(f"{item['name']}\t\t{item['quantity']}\t\t{item['price'] * item['quantity']}")
print("----------------------------------------")
print(f"Total:\t\t\t\t{total}")
print("***************************************")

def canteen_bill():
items = []

while True:
display_menu()
item_id = input("Enter item ID (or 'q' to quit): ")
if item_id == 'q':
break

item_info = MENU.get(item_id)
if not item_info:
print("Invalid item ID. Please select a valid item.")
continue

quantity = int(input("Enter item quantity: "))

item = {
'name': item_info['name'],
'price': item_info['price'],
'quantity': quantity
}

items.append(item)
10
total = calculate_total(items)
print_bill_to_file(items, total, "canteen_bill.txt")
print("Bill saved to canteen_bill.txt.")

print("\nPresent Bill:")
print_present_bill(items, total)

while True:
print_all_bills = input("Do you want to print all bills? (y/n): ").lower()
if print_all_bills == 'y':
with open("canteen_bill.txt", 'r') as file:
print(file.read())
break
elif print_all_bills == 'n':
break
else:
print("Invalid input. Please enter 'y' or 'n'.")

if __name__ == "__main__":
canteen_bill()

MODULES USED IN THIS CODE:

Certainly! Here's an explanation of each module used in the code:

menu.py Module:
1. Purpose: This module is responsible for managing the menu items and displaying them
to the user.

2. Components:
- MENU Dictionary: This dictionary holds the information about menu items, where each
item is associated with a unique ID. It contains item names and prices.
- display_menu() Function: This function displays the menu items with their IDs, names,
and prices in a structured format.

3. Functionality: The module's primary functionality is to present the available food items
to the user. It encapsulates the menu-related data and display logic, promoting code
reusability and maintaining a clear separation of concerns.
11
4. Concepts Demonstrated:
- Modularization: The module isolates menu-related functionality from the main billing
logic.
- Dictionary: The `MENU` dictionary stores menu items with IDs and their respective
details.
- Function: The `display_menu()` function encapsulates the code for displaying the menu.

canteen.py Module:
1. Purpose: This module constitutes the core of the canteen billing system, handling user
interactions, order placement, bill calculation, and bill storage.

2. Components:
- calculate_total(items) Function: Calculates the total cost of ordered items based on
their prices and quantities.
- print_bill_to_file(items, total, filename) Function: Writes the generated bill details to
a text file.
- canteen_bill() Function: This is the main function that orchestrates the entire billing
process. It interacts with users, processes orders, calculates bills, and saves the bill to a
file.
- if __name__ == "__main__": Block: Ensures that the `canteen_bill()` function is
executed when the script is run directly.

3. Functionality: The module's primary functionality is to facilitate the complete canteen


billing process, from user interaction to generating and saving the bill. It utilizes the
functions from `menu.py` to display the menu.

4. Concepts Demonstrated:
- Function: Multiple functions are defined to manage different aspects of the billing
process.
- User Input/Output: The functions interact with users by displaying prompts and
receiving input.
- File Handling: The `print_bill_to_file()` function demonstrates reading/writing
operations with external files.
- Conditional Statements : Control the flow of the program based on user input.
- Modular Programming: The module's functions encapsulate specific tasks, promoting
code organization and reusability.

Both modules work in tandem to create a comprehensive canteen billing system. The
separation of concerns between menu-related operations (`menu.py`) and billing
operations (`canteen.py`) exemplifies effective modular programming, promoting clarity
and maintainability.

12
RESULTS:

Menu:
Item ID Item Name Price
----------------------------------------
1 Burger $3.5
2 Pizza $4.0
3 Pasta $2.5
4 Sandwich $2.0
5 French Fries $1.5
----------------------------------------
Enter item ID (or 'q' to quit): 1
Enter item quantity: 6
Menu:
Item ID Item Name Price
----------------------------------------
1 Burger $3.5
2 Pizza $4.0
3 Pasta $2.5
4 Sandwich $2.0
5 French Fries $1.5
----------------------------------------
Enter item ID (or 'q' to quit): 8
Invalid item ID. Please select a valid item.
Menu:
Item ID Item Name Price
----------------------------------------
1 Burger $3.5
2 Pizza $4.0
3 Pasta $2.5
4 Sandwich $2.0
5 French Fries $1.5
----------------------------------------
Enter item ID (or 'q' to quit): 5
Enter item quantity: 3
Menu:
Item ID Item Name Price
----------------------------------------
1 Burger $3.5
2 Pizza $4.0
3 Pasta $2.5
4 Sandwich $2.0
5 French Fries $1.5
----------------------------------------
Enter item ID (or 'q' to quit): 2
13
Enter item quantity: 9
Menu:
Item ID Item Name Price
----------------------------------------
1 Burger $3.5
2 Pizza $4.0
3 Pasta $2.5
4 Sandwich $2.0
5 French Fries $1.5
----------------------------------------
Enter item ID (or 'q' to quit): 4
Enter item quantity: 5
Menu:
Item ID Item Name Price
----------------------------------------
1 Burger $3.5
2 Pizza $4.0
3 Pasta $2.5
4 Sandwich $2.0
5 French Fries $1.5
----------------------------------------
Enter item ID (or 'q' to quit): q
Bill saved to canteen_bill.txt.

Present Bill:
************* Canteen Bill *************
Item Quantity Price
----------------------------------------
Burger 6 21.0
French Fries 3 4.5
Pizza 9 36.0
Sandwich 5 10.0
----------------------------------------
Total: 71.5
***************************************
Do you want to print all bills? (y/n): y
************* Canteen Bill *************
Item Quantity Price
----------------------------------------
Burger 6 21.0
French Fries 3 4.5
Pizza 9 36.0
Sandwich 5 10.0
----------------------------------------
Total: 71.5
***************************************
14
APPLICATIONS:
The Canteen Billing System project has several practical applications that extend beyond
its immediate implementation. Here are a few potential applications:

1. Canteens and Cafeterias:


- The primary application is in canteens, cafeterias, or similar dining establishments. It
enhances the ordering and billing process, improving customer experience and
operational efficiency.

2. Small Restaurants and Food Stalls:


- Small-scale eateries can adopt this system to streamline their order-taking and billing
procedures. It's especially useful for places with limited staff where automating tasks can
reduce errors and waiting times.

3. Food Delivery Services:


- This system can be adapted for food delivery services, allowing customers to place
orders online and receive accurate bills for their selected items. It simplifies order
processing and ensures accurate payments.

4. Event Catering:
- Event catering services can utilize this system to efficiently manage orders and
generate bills during conferences, parties, and gatherings. It helps catering teams
accurately account for the ordered food and its cost.

5. Educational Institutions:
- School and college cafeterias can implement this system to facilitate the billing process
for students and staff. It can be customized to incorporate meal plans and discounts.

6. Employee Cafeterias:
- In workplaces with employee cafeterias, the system can be used to manage meal
orders, calculate bills, and maintain records. It aids in maintaining transparency in billing.

7. Fast Food Chains:


- Larger food chains can integrate this system into their operations to enhance the
ordering process and maintain consistency across different outlets.

8. Automated Vending Machines:


- The concept of automated billing can be extended to vending machines. Users can
select items, and the machine generates a bill or receipt.

9. Self-Service Kiosks:
15
- Restaurants and eateries with self-service kiosks can use this system to automate the
order placement and billing processes.

In essence, the Canteen Billing System showcases the potential of using programming to
optimize everyday processes, making them more efficient, accurate, and user-friendly
across various industries.

REFERENCES:
https://www.geeksforgeeks.org/
Tutorials And Articles (tutorialspoint.com)

16

You might also like