INDEX
SNO TOPIC PAGE SIGNATURE
NO:
1. INTRODUCTION 02
2. OBJECTIVE 03-04
3. MODULES IMPORTED
AND FUNCTIONS USED 05
4. SYSTEM 06
REQUIREMENTS
5. FEASIBILITY STUDY 07-08
6. ERRORS AND ITS 09
TYPES
7. MAINTENANCE 10-11
8. FLOW CHART 12
9. SOURCE CODE 13-14
10. OUTPUT 15-17
11. CONCLUSION 18
12. BIBLIOGRAPHY 19
1
INTRODUCTION
This Starbucks billing system is a Python-based program designed to
emulate a simple Point of Sale (POS) system for a café. The system allows
users to view a Starbucks menu, place orders, calculate bills, and store
each order in a persistent file for easy access to sales data. This program
is a useful tool for demonstrating file handling in Python and can serve as
a model for small businesses looking for a basic billing solution.
Key Features:
• Menu Display: Shows the available menu items and prices for
customers.
• Order Input: Allows customers to place multiple orders without
restarting the program.
• Real-Time Billing: Calculates the total bill based on selected items
and their quantities.
• Persistent Order Records: Each order is saved in a text file
(orders.txt) for continuous record-keeping.
• User-Friendly Interface: Simple text-based prompts guide the user
through the order and billing process.
Technologies Used:
• Python Programming Language: The entire application is coded in
Python, utilizing its built-in capabilities for handling files and
managing user inputs.
• File Handling in Python: The program reads from and writes to
text files (menu.txt and orders.txt) to store menu data and record
orders.
• Control Structures: Uses loops and conditional statements to
manage order-taking, bill calculation, and session control.
• String Manipulation: Splits and cleans strings from files to parse
the menu and format bill output.
These technologies combine to create a simple but effective billing system
that is easy to use, maintain, and extend if additional features are needed.
2
OBJECTIVES
The objective of this Starbucks billing system is to create a user-friendly,
efficient tool that manages customer orders and generates detailed bills
for each transaction. By implementing a streamlined interface and
essential billing functionalities, this program serves as an effective point-
of-sale solution and a hands-on educational project for understanding file
handling, loops, and input management in Python. Key points of the
objective are detailed below:
1. Enhanced Order Management:
The program’s primary purpose is to simplify the order-taking
process in a café environment. It allows users to select items from a
Starbucks menu, specify quantities, and add each item to an order
list. This setup makes it easy to manage multiple items per order
without manual calculations.
2. Automated Bill Calculation:
The system calculates the total bill for each order automatically,
summing the cost of each item based on quantity. This reduces
human error in calculation and provides the customer with a precise
total. It also saves time for the cashier, improving efficiency during
high-traffic periods.
3. Persistent Record-Keeping:
A key objective is to maintain a continuous record of all transactions.
Each order is saved in a text file, creating a historical log of all
customer interactions. This feature can be invaluable for keeping
track of sales data, reviewing orders, and generating simple sales
reports if needed. With this, the program mimics real-world point-of-
sale systems that retain transaction data for future reference.
4. User-Friendly Interface:
The interface is designed to be straightforward and easy to navigate.
Customers or cashiers are prompted at each step, from item selection
to quantity input. After each order, a summary of items and their
total cost is displayed, ensuring clarity and satisfaction. Additionally,
the system checks for valid inputs, providing feedback if an item is
3
not available on the menu.
5. Continuous Order Support:
One of the main objectives is to support continuous orders within a
single session. The system can handle multiple customers
consecutively without requiring a reset or restart. After each order,
the program prompts the user to take another order, making it ideal
for real-time, busy environments.
6. Educational Tool for Python Concepts:
This program is also aimed at serving as an educational example,
especially for beginners learning Python. By integrating file handling,
control structures, and input management, the program offers a
practical application of these concepts. The file handling operations—
reading from a menu file and appending orders to an order file—
demonstrate essential file management skills. The use of loops,
conditionals, and error handling makes the code easy to follow and
modify for further learning.
7. Scalability for Future Enhancements:
Although designed as a basic billing system, this project lays the
groundwork for future improvements. The modular structure allows
for easy additions, such as new menu items, discounts, or even a GUI
interface in the future. This adaptability makes the system a valuable
tool not only for educational purposes but also as a foundation for
more advanced projects.
8. Cost-Effective for Small Businesses:
For small businesses needing a basic POS system without investing in
expensive software, this program offers a viable solution. It leverages
open-source Python, and with minor adaptations, it could be
implemented in a small café or food stall environment. By using
simple text files, it avoids complex database management while
providing enough functionality for basic order tracking and billing.
4
MODULES IMPORTED
AND FUNCTIONS USED
No external modules are imported in this program. It uses Python’s
built-in open() function for file handling, and basic control structures
like while and if statements to handle menu options and user input.
➢ open(file, mode): Used to open files in different
modes (w, r, a) for writing, reading, and appending. It
manages the menu file and the order file.
➢ print(): Used extensively to display the menu, order
prompts, and bill summaries to the user.
➢ input(): Collects user inputs for menu items,
quantities, and session controls.
➢ strip(): Cleans up extra spaces and newline
characters from strings, making data uniform.
➢ split(): Splits menu items and prices in the menu file,
enabling data parsing.
5
SYSTEM REQUIREMENTS
Hardware:
❖ Any standard desktop or laptop computer.
❖ Minimum 4GB RAM.
Software:
❖ Python 3.x installed.
❖ A text editor or Python IDE for running the code.
❖ Basic file system (Windows, macOS, or Linux)
for managing the menu.txt and orders.txt fil
6
FEASIBILITY STUDY
The feasibility of the Starbucks billing system project can be
analyzed across three main dimensions: technical, operational,
and economic. Each dimension assesses how well the system can
meet its objectives and serve as a practical solution for order
management and billing.
1. Technical Feasibility:
This project is highly technically feasible as it uses
fundamental Python programming concepts, which are
widely accessible and easy to implement. Python's file
handling capabilities allow for effective data management
without requiring complex databases or additional software.
The program relies on basic control structures like loops and
conditionals, ensuring it can run on virtually any system with
Python 3 installed. The use of text files
(menu.txt and orders.txt) simplifies storage and reduces
technical complexity, making the system manageable for
beginners and adaptable for more advanced users.
Additionally, this technical simplicity makes it easy to scale,
allowing for future enhancements like adding new menu
items or integrating with more sophisticated POS features.
2. Operational Feasibility:
This program is designed with user-friendliness in mind,
making it easy for cashiers or customers to navigate without
7
extensive training. The text-based prompts guide the user
through the entire process, from item selection to order
confirmation and bill calculation. This clear flow minimizes
user error and helps maintain an efficient order-taking
process, even in a busy café environment. The ability to take
multiple, continuous orders without restarting the system
also makes it suitable for real-time use in cafés and small
businesses. Additionally, since it stores each transaction in a
persistent file, management can retrieve and review previous
orders if needed, which adds to its operational effectiveness.
3. Economic Feasibility:
This system is economically feasible as it does not require
any significant financial investment. It uses open-source
software (Python), so there are no licensing fees or costs
associated with setup. The use of text files instead of
databases also reduces costs, making it a low-budget option
for small businesses. This can be particularly beneficial for
startups or small-scale cafés that need a simple yet
functional billing solution without investing in expensive POS
software. The program can also serve as a foundation for
future upgrades, allowing businesses to add more features
incrementally without significant additional costs.
8
ERRORS AND ITS TYPES
This code can encounter a few types of errors, such as:
1.Input Errors:
• Entering an item name that is not in the menu
may cause logical errors, though it’s handled by
an error message.
• Non-numeric input for quantity could raise an
error if validation isn't handled.
2.File Handling Errors:
• If menu.txt or orders.txt cannot be opened (e.g.,
due to permission issues or missing files), it could
raise an IOError.
3.Logic Errors:
• If the user inputs a negative quantity, it could
lead to inaccurate billing.
9
MAINTENANCE
Maintaining the Starbucks billing system involves several
key tasks to ensure the system continues running smoothly
and remains accurate. Effective maintenance will help in
updating the system, managing potential errors, and
optimizing performance. The following are critical areas for
ongoing maintenance:
1. Menu Updates:
• Regularly update menu.txt to reflect any changes
in product offerings or prices.
• Add, remove, or modify items as the menu
evolves, ensuring customers have access to an
accurate menu.
• Verify that any additions follow the same format to
avoid data parsing issues.
2. Error Handling and Debugging:
• Periodically review the code for possible
improvements in error handling.
• Add validation checks for user inputs (e.g., valid
menu item names, quantities), helping to prevent
common input errors.
• Use try-except blocks to handle unexpected errors,
especially in file operations, ensuring smooth
performance.
3. File Management:
• Monitor the orders.txt file for size and storage
space. Over time, this file could grow significantly,
impacting performance.
10
• Archive or clear old order records periodically to
optimize system performance while keeping
essential sales data.
• Consider creating monthly or yearly archives to
separate historical data and make retrieval easier.
4. System Performance Optimization:
• Test the program regularly to ensure performance
is optimal and that no unnecessary delays occur in
order processing or bill calculation.
• Optimize any slow-running parts of the code,
especially as new features are added.
5. System Documentation:
• Update documentation to reflect any changes or
new features added to the system, making future
maintenance easier for new developers or users.
• Maintain a log of modifications to keep track of
when changes were made and why.
6. Future Scalability:
• Plan for future enhancements, such as moving
from text-based files to a database if the volume
of orders increases significantly.
• Regularly evaluate new requirements and assess if
further updates or changes are necessary for
continued functionality
11
FLOWCHART
12
SOURCE CODE
# Step 1: Create or load the menu file with items and prices
menu_file = 'menu.txt'
with open(menu_file, 'w') as f:
f.write("Espresso,3.00\n")
f.write("Cappuccino,4.50\n")
f.write("Latte,4.00\n")
f.write("Mocha,4.75\n")
f.write("Americano,3.25\n")
f.write("Frappuccino,5.00\n")
# Step 2: Load the menu from file and display it
menu = {}
with open(menu_file, 'r') as f:
for line in f:
item, price = line.strip().split(',')
menu[item] = float(price)
print("Welcome to Starbucks! Here is the menu:")
for item, price in menu.items():
print(f"{item}: ${price:.2f}")
# Step 3: Start a loop for continuous orders
while True:
print("\nNew Order")
# Take the user's order
order = []
while True:
item = input("Enter the item you'd like to order (or type 'done' to
finish): ").title()
if item.lower() == 'done':
break
elif item in menu:
quantity = int(input(f"Enter quantity for {item}: "))
order.append((item, quantity))
13
else:
print("Sorry, that item is not on the menu.")
# Calculate and save the bill in a continuous order file
total = 0
with open('orders.txt', 'a') as f:
f.write("\nStarbucks Bill\n")
f.write("---------------\n")
for item, quantity in order:
item_total = menu[item] * quantity
total += item_total
f.write(f"{item} x{quantity} - ${item_total:.2f}\n")
f.write("---------------\n")
f.write(f"Total: ${total:.2f}\n")
f.write("---------------\n")
# Display the bill to the user
print("\nYour bill:")
for item, quantity in order:
item_total = menu[item] * quantity
print(f"{item} x{quantity} - ${item_total:.2f}")
print("---------------")
print(f"Total: ${total:.2f}")
print("---------------")
# Ask if they want to take another order
more_orders = input("Would you like to take another order? (yes/no):
").strip().lower()
if more_orders != 'yes':
print("Thank you for using the Starbucks billing system!")
break
14
OUTPUT
15
Final bill is saved in orders.txt file:
16
Menu saved in menu.txt file:
17
CONCLUSION
This Python code simulates a Starbucks ordering and billing
system, where a customer can view a menu, place an order with
quantities, and receive a bill. The program stores the menu items
and their prices in a text file, loads them into a dictionary for
easy access, and provides a loop for continuous ordering until the
customer decides to finish. Each order is recorded in a separate
file, "orders.txt," ensuring that the system can track multiple
transactions over time. The customer is also given the option to
continue ordering or exit the program at any time.
This system is an example of basic file handling, user input
validation, and looping in Python. It allows for a real-world use
case of maintaining an order log and providing a clear output of a
customer's total bill. The use of text files for storing menu data
and orders ensures persistence, making it a practical choice for
simple applications such as this one.
18
BIBLIOGRAPHY
1. Python Documentation: Python.org. "File
Objects." https://docs.python.org/3/tutorial/inputoutput.html.
2. W3Schools: "Python File
Handling." https://www.w3schools.com/python/python_file_handling.as
p.
3. GeeksforGeeks: "Python
Dictionary." https://www.geeksforgeeks.org/python-dictionary/.
4. Stack Overflow: "How to handle user input validation in
Python?" https://stackoverflow.com/questions/5225627/how-to-handle-
user-input-validation-in-python.
19
20