Final Us
Final Us
MODI
GLOBAL SCHOOL
COMPUTER SCIENCE
Project on Payroll
Management System
Submitted By : Ajita Shukla Submitted To :
MR. AVLOKAN
Enrollment No :
MOHAN
CLASS XII
SESSION 2024-25
CERTIFICATE
1. Acknowledgement
2. About Python
3. About MySQL
5. Project Description
7. Program Code
8. Program Output
9. Bibliography
ACKNOWLEDGEMENT
This project consumed a huge amount of work, research and dedication. Still,
implementation would not have been possible if we did not have the support of
our classmates and the school officials. Therefore, we would like to extend our
sincere gratitude to all of them.
We would like to express our sincere thanks towards the team members who
devoted their time and knowledge in the implementation of this practical file.
Nevertheless, we express our gratitude toward our families and classmates for
their kind cooperation and encouragement which helped us in the completion
of this practical file.
ABOUT PYTHON
Python is a high-level, interpreted programming language that is
known for its simplicity and readability. It was created by Guido van
Rossum and first released in 1991. Python is designed to be easy to
learn and has a clear and straightforward syntax, which makes it an
excellent choice for beginners as well as experienced developers.
Here are some key features and applications of Python:
Features of Python:
1. Easy to Learn and Read: - Python's syntax is clean and easy to
understand, making it suitable for beginners. The readability of
Python code is one of its strengths, as it resembles the English
language.
2. Versatility: - Python is a versatile language that can be used for
various types of programming, including web development, data
science, artificial intelligence, machine learning, automation, and
more.
3. Interpreted and Dynamically Typed: - Python is an interpreted
language, meaning that the code is executed line by line. It is also
dynamically typed, allowing developers to create variables without
explicitly declaring their data types.
Applications of Python:
1. Web Development: - Python is widely used for web development,
with frameworks like Django and Flask providing tools for building
scalable and maintainable web applications.
2. Data Science and Machine Learning: - Python has become a
popular language for data science and machine learning. Libraries like
NumPy, Pandas, and scikit-learn are commonly used for data
analysis, manipulation, and machine learning tasks
ABOUT MYSQL
MySQL is an open-source relational database management system
(RDBMS) that is widely used for managing and organizing large
volumes of data. Developed by Oracle Corporation, MySQL is known
for its performance, reliability, and ease of use.
Hardware :
• Processor : intel(R) Core(TM) i5-8265U CPU @ 1.60GHz 1.80 GHz
Software:
• Operating System : Windows 7 or above
1. Add Employee
2. Remove Employee
3. Promote Employee
4. Display Employee
5. Exit
1. Add Employee:-
This is used to add a employee detail to an existing table.
2. Remove Employee:-
This is used to remove any employee details.
3. Promote Employee:-
This is used to promote post or salary of any employee.
4. Display Employee:-
This is used to display employee details.
5. Exit :-
This is used to exit the management system.
DATA DICTIONARY
I. LIST OF MODULES
1) mysql.connector module:- MySQL Connector enables
Python programs to access MySQL databases. It is written in pure Python and
does not have any dependencies except for the Python Standard Library.
2.add_emp() :-
This is a take nothing return nothing type nature function .This is
designed to add a new employee details. This function include taking employee
details as input .
3.remove_emp() :-
This is a take nothing return nothing type nature function .This is
designed to remove any employee details. This function include taking
employee id as input and delete its detail .
4. promote_emp() :-
This is a take nothing return nothing type nature function .This is
designed to update employee salary/post. It furthers include two choice i.e, to
update employee salary and to update employee post. It takes employee id and
updated details as input and update it .
5.display_emp() :-
This is a take nothing return nothing type nature function .This is
designed to display employee details. It furthers include two choice i.e, to
display a particular employee details and to display all employee details.
6.menu() :-
This function includes the menu and the combination of the code.It is the
main source code in which there are 5 choices and each choice further and all
other user defined functions are invoked here. This function is invoked at the
end of most of user defined functions.
.
PROGRAM CODE -
import mysql.connector as m
db=m.connect(host="localhost", user="root", password="password",
database="emp")
c=db.cursor()
def check_emp(empid):
s="select * from employee where id = %s;"
data=(empid,)
c.execute(s,data)
r=c.rowcount
if r==1:
return True
else:
return False
def add_emp():
id=input("Enter employee id : ")
if (check_emp(id))==True:
print("Employee Id already exist ")
menu()
else:
name=input("Enter Employee Name :")
post=input("Enter Employee post :")
salary=input("Enter Employee salary :")
data=(id,name,post,salary)
s="insert into employee values(%s,%s,%s,%s);"
c.execute(s,data)
db.commit()
print("Data added successfully")
menu()
def remove_emp():
id=input("Enter employee id : ")
if (check_emp(id))==False:
print("Employee Id do not exist ")
menu()
else:
s="delete from employee where id=%s;"
data=(id,)
c.execute(s,data)
db.commit()
print("employee data removed successfully")
menu()
def promote_emp():
id=input("Enter employee id : ")
if (check_emp(id))==False:
print("Employee Id do not exist ")
menu()
else:
print("1.Promote employee post","2.Increase salary of
employee",sep="/n")
choice=int(input("enter a choice (1/2) :"))
if choice==1:
s="update employee set post=%s where id=%s;"
post=input("Enter updated post: ")
data=(post,id)
c.execute(s,data)
db.commit()
print("Employee's post is updated")
elif choice==2:
s="update employee set salary=%s where id=%s;"
salary=input("Enter updated salary: ")
data=(salary,id)
c.execute(s,data)
db.commit()
print("Employee's salary is updated")
else:
print("Invalid choice")
menu()
def display_emp():
print("1.Display one employee record")
print("1.Display all employees records.")
choice=input("Enter your choice :")
if choice==1:
id=input("Enter employee id : ")
if (check_emp(id))==False:
print("Employee Id do not exist ")
else:
s="select * from employee where id=%s;"
data=(id,)
c.execute(s,data)
r=c.fetchone()
print("Employee id : ",r[0])
print("Employee name : ",r[1])
print("Employee post : ",r[2])
print("Employee salary : ",r[3])
print("------------")
elif choice==2:
s="select * from employee;"
c.execute(s)
r=c.fetchall()
for i in r:
print("Employee id : ",i[0])
print("Employee name : ",i[1])
print("Employee post : ",i[2])
print("Employee salary : ",i[3])
else:
print("Invalid choice")
menu()
def menu():
print("-------Welcome to Payroll Management System------")
print(" Enter 1 to Add Employee")
print(" Enter 2 to Remove Employee")
print(" Enter 3 to Promote Employee")
print(" Enter 4 to Display Employee")
print(" Enter 5 to Exit")
choice=int(input("Enter your choice :"))
if choice==1:
add_emp()
elif choice==2:
remove_emp()
elif choice==3:
promote_emp()
elif choice==4:
display_emp()
elif choice==5:
print(“Thank you for visiting”)
exit()
else:
print("Invalid choice ,try again")
menu()
menu()
- OUTPUT -
BIBLIOGRAPHY
I. Books
1. Computer Science with Python – Preeti Arora
2. Computer Science with Python – Sumita Arora
II. Websites
1. www.geeksforgeeks.org
2. www.pypi.org
3. www.w3schools.com