0% found this document useful (0 votes)
87 views

Computer Science Project File

This document provides an overview of Python programming language and databases. It discusses that Python is a widely used programming language created in 1991 with an emphasis on code readability. It then provides details on database concepts, including that a database is a collection of related information organized in tables with rows and columns. It also discusses the role of database management systems like MySQL to organize and retrieve data from databases. The document then covers problem definition and analysis in software development as well as system design, implementation details using Python and MySQL, and coding the source code for an electricity billing system as an example.

Uploaded by

mranonymous8069
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

Computer Science Project File

This document provides an overview of Python programming language and databases. It discusses that Python is a widely used programming language created in 1991 with an emphasis on code readability. It then provides details on database concepts, including that a database is a collection of related information organized in tables with rows and columns. It also discusses the role of database management systems like MySQL to organize and retrieve data from databases. The document then covers problem definition and analysis in software development as well as system design, implementation details using Python and MySQL, and coding the source code for an electricity billing system as an example.

Uploaded by

mranonymous8069
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

1.

IntroductIon
Python is a widely used general-purpose, high
level programming language. It was created by
Guido van Rossum in 1991 and further developed
by the Python Software Foundation. It was
designed with an emphasis on code readability,
and its syntax allows programmers to express
their concepts in fewer lines of code. Python is a
programming language that lets you work quickly
and integrate systems more efficiently. There are
two major Python versions: Python 2 and Python
3. Both are quite different. Learning Python gives
the programmer a wide variety of career paths to
choose from. Python is an open-source (free)
programming language that is used in web
programming, data science, artificial intelligence,
and many scientific applications. Learning Python
allows the programmer to focus on solving
problems, rather than focusing on syntax. Its
relative size and simplified syntax give it an edge
over languages like Java and C++, yet the
abundance of libraries gives it the power needed
to accomplish great thing.

2. theoretIcal
Background
2.1 What is Database?

Introduction and Concepts:


A database is a collection of information related to
a particular subject or purpose, such as tracking
customer orders or maintaining a music collection.
Using any RDBMS application software like MS
SQL Server, MySQL, Oracle, Sybase etc, you can
manage all your information from a single
database file. Within the file, divide your data into
separate storage containers called tables. You may
and retrieve the data using queries. A table is a
collection of data about a specific topic, such as
products or suppliers. Using a separate table for
each topic means you can store that data only
once, which makes your database more efficient
and reduces data-entry errors. Table organises
data into columns (called fields) and rows (called
records). A Primary key is one or more fields
whose value or values uniquely identify each
record in a table. In a relationship, a primary key is
used to refer to specific record in one table from
another table. A primary key is called foreign key
when it is referred to from another table. To find
and retrieve just the data that meets conditions
you specify, including data from multiple tables,
create a query. A query can also update or delete
multiple records at the same time, and perform
built-in or custom calculations on your data.
Role of RDBMS Application Program:
A computer database works as a electronic filing
system, which has a large number of ways of
cross-referencing, and this allows the user many
different ways in which to re-organize and retrieve
data. A database can handle business inventory,
accounting and filing and use the information in
its files to prepare summaries, estimates and
other reports. The management of data in a
database system is done by means of a general-
purpose software package called a Database
Management System (DBMS). Some commercially
available DBMS are MS SQL Server, MS ACCESS,
INGRES, ORACLE, and Sybase. A database
management system, therefore, is a combination
of hardware and software that can be used to set
up and monitor a database, and can manage the
updating and retrieval of database that has been
stored in it. Most of the database management
systems have the following capabilities:
♦ Creating of a table, addition, deletion,
modification of records.
♦ Retrieving data collectively or selectively.
♦ The data stored can be sorted or indexed at the
user's discretion and direction.
♦ Various reports can be produced from the
system. These may be either standardized report
or that may be specifically generated according to
specific user definition.
♦ Mathematical functions can be performed and
the data stored in the database can be
manipulated with these functions to perform the
desired calculations.
♦ To maintain data integrity and database use.
The DBMS interprets and processes users'
requests to retrieve information from a database.
In most cases, a query request will have to
penetrate several layers of software in the DBMS
and operating system before the physical
database can be accessed. The DBMS responds to
a query by invoking the appropriate subprograms,
each of which performs its special function to
interpret the query, or to locate the desired data
in the database and present it in the desired
order.

2.2 What is My SQL ?


The management of data in a
database system is done by means of a general-
purpose software package called a Database
Management System (DBMS). Some commercially
available RDBMS are MS SQL Server, MS ACCESS,
INGRES, ORACLE, and Sybase. MySQL, the most
popular Open Source SQL database management
system, is developed, distributed, and supported
by Oracle Corporation. MySQL is named after co-
founder Monty Widenius's daughter, My. The
name of the MySQL Dolphin (our logo) is “Sakila,”.
● MySQL is a database management system.
A database is a structured collection of data. It
may be anything from a simple shopping list to a
picture gallery or the vast amounts of information
in a corporate network. To add, access, and
process data stored in a computer database, you
need a database management system such as
MySQL Server. Since computers are very good at
handling large amounts of data, database
management systems play a central role in
computing, as standalone utilities, or as parts of
other applications.
● MySQL is based on SQL.
A relational database stores data in separate
tables rather than putting all the data in one big
storeroom. This adds speed and flexibility.
● MySQL software is Open Source.
Open Source means that it is possible for anyone
to use and modify the software. Anybody can
download the MySQL software from th e Internet
and use it without paying anything.
● The MySQL Database Server is very fast,
reliable, and easy to use.
If that is what you are looking for, you should give
it a try. MySQL Server also has a practical set of
features developed in close cooperation with our
users. Its connectivity, speed, and security make
MySQL Server highly suited for accessing
databases on the Internet.
● MySQL Server works in client/server or
embedded systems.
The MySQL Database Software is a client/server
system that consists of a multi-threaded SQL
server that supports different backends, several
different client programs and libraries,
administrative tools, and a wide range of
application programming interfaces (APIs)
3. ProBlem defInItIon &
analysIs
The hardest part of building a software system is
deciding precisely what to build. No other part of
the conceptual work is so difficult as establishing
the detailed technical requirement. Defining and
applying good, complete requirements are hard to
work, and success in this endeavor has eluded
many of us. Yet, we continue to make progress.
Problem definition describes the What of a
system, not How . The quality of a software
product is only as good as the process that creates
it. Problem definition is one of the most crucial
steps in this creation process. Without defining a
problem, developers do not know what to build,
customers do not know what to expect, and there
is no way to validate that the built system satisfies
the requirement.
Problem definition and Analysis is the activity that
encompasses learning about the problem to be
solved, understanding the needs of customer and
users, trying to find out who the user really is, and
understanding all the constraints on the solution.
It includes all activities related to the following:
✔ Identification and documentation of user’s
needs.
✔ Creation of a document that describes the
external behavior and the association constraints
that will satisfies those needs.
✔ Analysis and validation of the requirements
documents to ensure consistency, completeness,
and feasibility
✔ Evolution of needs.
✔ The proposed system should maintain all the
records , and should generate the required reports
and information when required.
✔ To provide efficient and secured Information
storage, flow and retrieval system, ensuring the
integrity and validity of records.
✔ To provide graphical and user-friendly interface
to interact with a centralized database based on
client-server architecture.
✔ To identify the critical operation procedure and
possibilities of simplification using modern IT tools
and practices.

4. system
ImPlementatIon
4.1 SOFTWARE SPECIFICATIONS:-
Operating System : Windows 7
Platform : Python IDLE 3.7
Database : MySQL SERVER 5.1
Languages : Python

4.2 HARDWARE SPECIFICATION:-


Processor : Dual Core and above
Hard Disk : 40 GB
Ram : 1024 MB

Note: For Python-MySQL connectivity, following


data have been used:-
Host- localhost, user- root, password-
MANAGER, database- EBS

5. system desIgn &


develoPment
5.1 Database Design:
An important aspect of system design is the
design of data storage structure. To begin with a
logical model of data structure is developed first.
A database is a container object which contains
tables, queries, reports and data validation
policies enforcement rules or constraints etc. A
logical data often represented as a records are
kept in different tables after reducing anomalies
and redundancies. The goodness of data base
design lies in the table structure and its
relationship.
5.2 CODING:
SOURCE CODE
import mysql . connector as sql , random , datetime as dt
import matplotlib .pyplot as plt
conn=sql.connect(host='localhost',user='root',passwd='mana
ger',dat abase='EBS')
if conn.is_connected():
print("successfully connected")
c='YES' or "yes" or 'Yes'
V='YES' or "yes" or 'Yes'
c1=conn.cursor()
while c=='YES' or "yes" or 'Yes':
print('************************WELCOME TO

ELECTRICITY BILLING SYSTEM************************')


print(dt.datetime.now())
print('1.NEW USER')
print('2.EXISTING USER')
print('3.EXIT')
choice1=int(input('ENTER YOUR CHOICE:'))
if choice1==1:
username=input("Enter your username number :")
password=input("Enter your password:")
confirmpasswd=Input("Confirm your password:")
if password==confirmpasswd:
info1="insert into
newuservalues('{}','{}','{}')".format(username,password,confir
mpasswd)
c1.execute(info1)
conn.commit()
c=input("do you want to continue?(yes or no)")
else:
print('your confirm password is incorrect')
print('Try again')
c=input("do you want to continue?(yes or no)")
elif choice1==2:
username=input('Enter your username:')
password=input('Enter your password:')
info2="select * from newuser where username='{}'
and password='{}'".format(username,password)
c1.execute(info2)
data=c1.fetchall()
while V=='YES' or "yes" or 'Yes':
if any(data):
print('************************WELCOME
TO ELECTRICITY BILLING
SYSTEM************************')
print("1.ACCOUNT SETTINGS")
print("2.TRANSACTION")
print("3.VIEW CUSTOMER DETAILS")
print("4.GRAPHICAL REPRESENTATION")
print('5.EXIT')
choice2=int(input('ENTER YOUR CHOICE'))
if choice2==1:
print('1.NEW CUSTOMER')
print('2.DELETE EXISTING ACCOUNT')
choice12=int(input('ENTER YOUR CHOICE:'))
if choice12==1:
accountno=random.randrange(1000000,9999999,10)
print("your accountno is",accountno)
boxid=input("enter your mete box ID:")
bankname=input('Enter your BANK
NAME :')
bankbranch=input('Enter your BANK
BRANCH :')
name=input('Enter your name :')
address=input('Enter your address :')
areacode=int(input('Enter your area
PIN CODE :'))
phoneno=int(input('Enter your PHONE
NUMBER :'))
email=input('Enter your email :')
info2="insert into
AddNewCustomervalues({},'{}','{}','{}','{}',{},{},'{}','{}')".format(
accountno,bankname,bankbranch,name,address,areacode,p
honeno,email,boxid)
c1.execute(info2)
conn.commit()
V=input("do you want to
continue?(yes or no)")
if V=='yes':
continue
else:
break
elif choice12==2:
acc=input("ENTER YOUR ACCOUNT
NUMBER:")
use=input("ENTER YOUR USERNAME:")
info6=c1.execute("delete from
Transaction where accountno='{}'".format(acc))
info7=c1.execute("delete from
AddNewCustomer where accountno='{}'".format(acc))
info8=c1.execute("delete from
newuser where username='{}'".format(use))
c1.execute(info6)
c1.execute(info7)
c1.execute(info8)
conn.commit()
print("THANK YOU FOR
USING OUR SOFTWARE,YOUR ACCOUNT IS SUCCESFULLY
DELETED")
V=input("do you want to
continue?(yes or no)")
if V=='yes':
continue
else:
break
elif choice2==2:
accountno=int(input('Enter your account
number :'))
info10="select * from Transaction where
accountno="+str(accountno)
c1.execute(info10)
data3=c1.fetchall()
for row in data3:
paid=row[6]
if paid=='yes':
print('you have already paid the bill')
break
else:
unit=random.randint(0,101)
print('Dear customer, you have
used ',unit,'units of electricity.')
print('One unit of curent is 150
ruppees')
amount=150*unit
toda=dt.date.today()
deadline=dt.date(2020,1,30)
if deadline<toda:
fine=(toda-deadline)*30
totamt=amount+fine
print('you have delayed
for ',toda-deadline,'days.The fine per day is 30 rupees.')
GST=(15/100)*totamt
totalamt=totamt+GST
print('Pleae payup
',totalamt,'rupees inclding GST')
p=input("Please Enter
YES to transact")
if p=="YES"or 'Yes'or'yes':
print("Transaction successful")
print("You have paid the bill")
else:
print('plz pay the bill sooner')
else: totamt=0
GST=(15/100)*amount
totalamt=amount+GST
print('Pleae payup
',totalamt,'rupees inclding GST')
p=input("Please Enter YES to
transact")
if p=="YES":
print("Transaction successful")
print("You have paid the bill")
else:
print('plz pay the bill sooner')
info3="insert into Transaction
values({},{},'{}',{},{},{},'{}')".format(accountno,unit,toda,totam
t,GST,totalamt,p)
c1.execute(info3)
conn.commit()
V=input("do you want to
continue?(yes or no)")
if V=='yes':
continue
else:
break
elif choice2==3:
accountno=int(input('Enter your account
number :'))
info4="select * from
AddNewCustomer where accountno=" + str(accountno)
c1.execute(info4)
data1=c1.fetchall()
for row in data1:
print(" Account Number: ", row[0])
print("bankname:",row[1])
print("bankbranch:",row[2])
print("Person name:",row[3])
print("Your meter device
ID=",row[8]
print("Residential
address:",row[4])
print("area code:",row[5])
print("phone number:",row[6])
print("email:",row[7])
info5="select * from
Transaction where accountno=" + str(accountno)
c1.execute(info5)
data2=c1.fetchall()
for row in data2:
print(" Unit : ",row[1])
print(" paid on:",row[2])
print("amount to be paid
without GST:",row[3])
print("GST=",row[4])
print("amount to be paid
including GST:",row[5])
V=input("do you want to continue?(yes
or no)")
if V=='yes':
continue
else:
break
elif choice2==4:
info9="select
accountno,totalamt from Transaction"
c1.execute(info9)
L1,L2,=[],[]
for i in c1.fetchall():
L1.append(i[0])
L2.append(i[1])
plt.plot(L1,L2)
plt.title("GRAPH")
plt.show()
V=input("do you want to
continue?(yes or no)")
if V=='yes':
continue
else:
break
elif choice2==5:
print( "THANK YOU!!!! VISIT
AGAIN!!!!")
break
c='yes'

else:
print('username / password is incorrect')
break
c=input("do you want to try again?(yes or
no)")
else:
print( "THANK YOU!!!! VISIT AGAIN!!!!")
V='no'
elif choice1==3:
print( "THANK YOU!!!! VISIT AGAIN!!!!")
c='no'
break
else:
print("invalid choice")
c=input("do you want to try again?(yes or
no)")
else:
print( "THANK YOU!!!! VISIT AGAIN!!!!")
c='no'
import mysql.connector as sql
conn =
sql.connect(host='localhost',user='root',password='manager',
databa se='EBS')
if conn.is_connected():
print("successfully connected")
c1=conn.cursor()
c1.execute('create table newuser(username VARCHAR(100)
primary key,password VARCHAR(100),confirmpasswd
VARCHAR(100))')
c1.execute('create table AddNewCustomer(accountno int
primary key,bankname VARCHAR(25),bankbranch
VARCHAR(25),name VARCHAR(25),address
VARCHAR(100),areacode INT(6),phoneno INT(15),email
VARCHAR(25),boxid VARCHAR(25))')
c1.execute('create table Transaction(accountno INT(10) ,unit
INT(10),toda VARCHAR(25),totamt INT(10),GST
INT(10),totalamt INT(10),p VARCHAR(25) , foreign
key(accountno) references AddNewCustomer(accountno))')
print("table created")
OUTPUT
6. references
In order to work on this project titled STOCK
MANAGEMENT , the following books and
literature are referred by me during the various
phases of development of the project.
(1) http://www.mysql.org/
(2) http://www.python.org/
(3) Informatics Practices for class XII
-by Sumita Arora & Preeti Arora
Website: https://www.w3resource.com

Other than the above-mentioned books, the


suggestions and supervision of my teacher and my
class experience also helped me to develop this
software project.

You might also like