Computer 2
Computer 2
Toll Management
INDEX
1.
S.No Titles Pg No
1) Introduction 2
2) Objectives 3
4) Feasibility Study 4
5) Use of Python 5
6) Uses of SQLit 6
Source Code
9) 10
10) Output 19
11) Summary 24
12) Bibiliography 26
1
1. Introduction
The Tollgate System is a
comprehensive software
application designed to automate
and simplify toll management
processes. It is developed using
Python, a versatile programming
language, and SQLite, a lightweight
database system. This combination
ensures the system is efficient,
scalable, and easy to deploy.
Manual toll collection systems are
often error-prone and inefficient,
causing delays and operational
challenges. By automating vehicle
registration, toll processing, and
transaction reporting, the Tollgate
System significantly enhances
operational efficiency and accuracy.
It is especially suited for small and
medium-scale tollgate operations
due to its ease of use and low cost.
2
The system not only minimizes
manual errors but also provides a
robust platform for recording and
analyzing toll transactions,
contributing to better decision-
making and operational
transparency.
2. Objectives
The Tollgate System aims to
achieve the following objectives:
1. Automation: Replace manual
toll collection with an automated
system for improved speed and
accuracy.
2. Efficiency: Minimize delays in
toll operations, ensuring a smooth
flow of vehicles.
3. Data Transparency: Maintain
detailed transaction records for
3
auditing and management
purposes.
4. User-Friendly Design:
Provide an intuitive interface for
operators to perform tasks with
ease.
5. Scalability: Ensure that the
system can handle increased
traffic and expand features over
time.
4
delays, leading to long queues
and congestion.
Lack of Records: Manual
systems often lack
comprehensive, easily accessible
transaction logs.
By integrating an automated
system, these challenges are
effectively resolved, improving both
operational efficiency and user
satisfaction.
4. Feasibility Study
4.1 Technical Feasibility
The system uses Python and
SQLite, which are lightweight and
require minimal resources, making
them technically viable even for
basic setups.
4.2 Economic Feasibility
5
The system is cost-effective due to
the use of open-source tools,
requiring minimal investment in
software and hardware.
4.3 Operational Feasibility
The system is easy to operate with
an intuitive GUI, enabling operators
with minimal technical expertise to
use it efficiently.
4.4 Scheduling Feasibility
The system can be deployed
quickly, as it involves minimal
setup and configuration.
5. Use of Python
Python serves as the backbone of
the Tollgate System. Its simplicity
and extensive library support make
it ideal for developing a system
with a graphical user interface
(GUI) and database connectivity.
6
The Tkinter library is used to create
an intuitive and user-friendly
interface, allowing operators to
interact with the system
seamlessly. Python's sqlite3 module
facilitates database integration,
enabling real-time storage and
retrieval of vehicle and transaction
data. Python's versatility and
robustness ensure the system can
handle complex operations
efficiently while maintaining ease
of development and scalability.
6. Use of SQLite
SQLite is the database
management system used in the
Tollgate System. It is chosen for its
lightweight nature, simplicity, and
ability to operate without requiring
a server. SQLite handles two main
tables in this program:
7
1. Vehicles Table: Stores
information about registered
vehicles, including vehicle
number, type, owner name, and
balance.
2. Transactions Table: Logs all
toll payments, including
transaction ID, vehicle number,
amount, and timestamp.
By using SQLite, the system
ensures data consistency and
security while keeping the setup
minimal and efficient for small to
medium-scale applications.
8
2. SQLite (integrated with
Python)
3. Tkinter for GUI
4. Operating System: Windows,
macOS, or Linux
Hardware Requirements:
1. Minimum 4GB RAM
2. Dual-core processor
3. 500MB free disk space
10
transactions for that period from
the database.
8.7 display_report
Presents the retrieved transactions
in a readable format or informs the
user if no transactions are found.
11
SOURC
E
CODE
12
import tkinter as tk
from tkinter import messagebox
import sqlite3
import datetime
class SimpleTollgateSystem:
def __init__(self, root):
self.root = root
self.root.title("Simple Tollgate System")
self.root.geometry("400x300")
self.conn =
sqlite3.connect('simple_tollgate.db')
self.c = self.conn.cursor()
13
self.c.execute('''CREATE TABLE IF NOT
EXISTS transactions (
transaction_id INTEGER
PRIMARY KEY AUTOINCREMENT,
vehicle_number TEXT,
amount REAL,
timestamp TEXT,
FOREIGN
KEY(vehicle_number) REFERENCES
vehicles(vehicle_number)
)''')
self.create_dashboard()
def create_dashboard(self):
self.dashboard_frame =
tk.Frame(self.root)
self.dashboard_frame.pack(pady=20)
tk.Button(self.dashboard_frame,
text="Register Vehicle",
command=self.register_vehicle).grid(row=0,
column=0, padx=5, pady=5)
tk.Button(self.dashboard_frame,
text="Process Toll",
command=self.process_toll).grid(row=0,
column=1, padx=5, pady=5)
tk.Button(self.dashboard_frame,
text="Generate Report",
14
command=self.generate_report).grid(row=1
, columnspan=2, padx=5, pady=5)
def register_vehicle(self):
self.clear_frames()
self.register_frame =
tk.Frame(self.root)
self.register_frame.pack(pady=20)
tk.Label(self.register_frame,
text="Vehicle Number:").grid(row=0,
column=0, padx=5, pady=5)
self.vehicle_number_entry =
tk.Entry(self.register_frame)
self.vehicle_number_entry.grid(row=0,
column=1, padx=5, pady=5)
tk.Label(self.register_frame,
text="Vehicle Type:").grid(row=1,
column=0, padx=5, pady=5)
self.vehicle_type_entry =
tk.Entry(self.register_frame)
self.vehicle_type_entry.grid(row=1,
column=1, padx=5, pady=5)
tk.Label(self.register_frame,
text="Owner Name:").grid(row=2,
column=0, padx=5, pady=5)
15
self.owner_name_entry =
tk.Entry(self.register_frame)
self.owner_name_entry.grid(row=2,
column=1, padx=5, pady=5)
tk.Label(self.register_frame,
text="Initial Balance:").grid(row=3,
column=0, padx=5, pady=5)
self.balance_entry =
tk.Entry(self.register_frame)
self.balance_entry.grid(row=3,
column=1, padx=5, pady=5)
tk.Button(self.register_frame,
text="Register",
command=self.process_registration).grid(ro
w=4, columnspan=2, padx=5, pady=5)
def process_registration(self):
vehicle_number =
self.vehicle_number_entry.get()
vehicle_type =
self.vehicle_type_entry.get()
owner_name =
self.owner_name_entry.get()
try:
balance =
float(self.balance_entry.get())
except ValueError:
16
messagebox.showerror("Error",
"Invalid balance amount. Please enter a
number.")
return
def process_toll(self):
self.clear_frames()
self.toll_frame = tk.Frame(self.root)
self.toll_frame.pack(pady=20)
17
tk.Label(self.toll_frame, text="Vehicle
Number:").grid(row=0, column=0, padx=5,
pady=5)
self.vehicle_number_entry =
tk.Entry(self.toll_frame)
self.vehicle_number_entry.grid(row=0,
column=1, padx=5, pady=5)
tk.Label(self.toll_frame, text="Toll
Amount:").grid(row=1, column=0, padx=5,
pady=5)
self.amount_entry =
tk.Entry(self.toll_frame)
self.amount_entry.grid(row=1,
column=1, padx=5, pady=5)
tk.Button(self.toll_frame, text="Process
Toll",
command=self.complete_toll_payment).grid
(row=2, columnspan=2, padx=5, pady=5)
def complete_toll_payment(self):
vehicle_number =
self.vehicle_number_entry.get()
try:
amount =
float(self.amount_entry.get())
except ValueError:
18
messagebox.showerror("Error",
"Invalid toll amount. Please enter a
number.")
return
if vehicle:
balance = vehicle[0]
if balance >= amount:
updated_balance = balance -
amount
timestamp =
datetime.datetime.now().strftime("%Y-%m-
%d %H:%M:%S")
self.c.execute("UPDATE vehicles
SET balance=? WHERE vehicle_number=?",
(updated_balance, vehicle_number))
self.c.execute("INSERT INTO
transactions (vehicle_number, amount,
timestamp) VALUES (?, ?, ?)",
(vehicle_number, amount, timestamp))
self.conn.commit()
messagebox.showinfo("Success",
"Toll paid successfully.")
self.toll_frame.destroy()
19
else:
messagebox.showerror("Error",
"Insufficient balance.")
else:
messagebox.showerror("Error",
"Vehicle not found.")
def generate_report(self):
self.clear_frames()
self.report_frame = tk.Frame(self.root)
self.report_frame.pack(pady=20)
tk.Label(self.report_frame, text="Start
Date (YYYY-MM-DD):").grid(row=0,
column=0, padx=5, pady=5)
self.start_date_entry =
tk.Entry(self.report_frame)
self.start_date_entry.grid(row=0,
column=1, padx=5, pady=5)
tk.Label(self.report_frame, text="End
Date (YYYY-MM-DD):").grid(row=1,
column=0, padx=5, pady=5)
self.end_date_entry =
tk.Entry(self.report_frame)
self.end_date_entry.grid(row=1,
column=1, padx=5, pady=5)
20
tk.Button(self.report_frame,
text="Generate Report",
command=self.display_report).grid(row=2,
columnspan=2, padx=5, pady=5)
def display_report(self):
start_date = self.start_date_entry.get()
end_date = self.end_date_entry.get()
try:
self.c.execute("SELECT * FROM
transactions WHERE timestamp BETWEEN ?
AND ?", (start_date, end_date))
transactions = self.c.fetchall()
if transactions:
report_window = tk.Toplevel()
report_window.title("Transaction
Report")
for i, transaction in
enumerate(transactions):
tk.Label(report_window,
text=f"Transaction {i+1}: Vehicle:
{transaction[1]}, Amount: {transaction[2]},
Date: {transaction[3]}").pack()
else:
messagebox.showinfo("Info", "No
transactions found for the given period.")
except Exception as e:
21
messagebox.showerror("Error",
str(e))
def clear_frames(self):
for widget in self.root.winfo_children():
widget.destroy()
def run(self):
self.root.mainloop()
def main():
root = tk.Tk()
app = SimpleTollgateSystem(root)
app.run()
if __name__ == "__main__":
main()
22
OUTPU
T
23
24
Registering
Vehicle
25
Processing toll
26
Generating
Report
27
SUMMARY
The Tollgate System is an
automated solution designed to
streamline toll management processes,
reducing errors, delays, and
inefficiencies associated with manual toll
collection.
28
Key features include vehicle
registration, toll payment processing,
and transaction reporting, all of which
are backed by an SQLite database for
reliable storage.
29
30
Bibiliography
1.GeeksforGeeks .com
2.Wikipedia https://www.wikipedia.org/
3.Class 11th & 12th Computer Science
Arihant
31