Project CALCULATOR-shivam OjhaPR
Project CALCULATOR-shivam OjhaPR
ON
“CALCULATOR”
SUBMITTED BY
Name : Shivam Ojha
Enroll No.:
Class : XII
Group Members : Aditya, Shivam Ojha, Sahil
Date: 11/28/2024
Name of Student: Shivam Ojha
APPROVED BY-
Name of Subject Teacher/Guide: Dr. Anu Aujla
TABLE OF CONTENT
1
SER DESCRIPTION PAGE NO
01 CERTIFICATE
02 ACKNOWLEDGEMENT
03 INTRODUCTION
05 PROPOSED SYSTEM
08 FLOW CHART
09 SOURCE CODE
10 OUTPUT
11 TESTING
13 REFERNCES
2
CERTIFICATE
I pay my gratitude and sincere regards to Dr. Anu Aujla, our project guide for
giving me the cream of her knowledge. I am thankful to her as she has been a
constant source of advice, motivation and inspiration. I am also thankful to her
for giving her suggestions and encouragement throughout the project work.
I take the opportunity to express our gratitude and thanks to our Principal,
Teachers and library staff for providing us the opportunity to utilize their
resources for the completion of the project.
3
PROJECT ON CALCULATOR
INTRODUCTION
• Purpose
• Perform mathematical operations (addition, subtraction, multiplication,
division, etc.).
• Store operation history and results in a MySQL database for
recordkeeping and analysis.
• Components:
• Python: The programming language used for creating the calculator's
logic and interacting with the database.
• MySQL: A relational database management system to store the operation
history (e.g., inputs, outputs, timestamps).
• Key Features:
• User Input Handling: Accept numeric inputs and operation choices from
the user.
• Computation: Perform calculations based on user input.
4
OBJECTIVES OF THE PROJECT
realworld scenario
PROPOSED SYSTEM
• User Interface
• A text-based interface for user input, built using Python's input()
• Calculation Module:
• Implements arithmetic logic to perform operations.
• Validates user inputs (e.g., ensuring no division by zero)
• Database Module:
5
• Manages connection to the MySQL database.
• Saves each operation, including inputs, results, and timestamps.
• Retrieves stored operations for user review.
6
and planning phases. End users of the system under development should be
involved in reviewing the output of each phase to ensure the system is being built
to deliver the needed functionality.
7
a proposal’s purpose, identify expected benefits, and explain how the proposed
system supports one of the organization’s business strategies. The business case
should also identify alternative solutions and detail as many informational,
functional, and network requirements as possible.
PLANNING PHASE
This phase formally defines the detailed functional user requirements using
highlevel requirements identified in the Initiation, System Concept, and Planning
phases. It also delineates the requirements in terms of data, system performance,
10
security, and maintainability requirements for the system. The requirements are
defined in this phase to a level of detail sufficient for systems design to proceed.
They need to be measurable, testable, and relate to the business need or
opportunity identified in the Initiation Phase. The requirements that will be used
to determine acceptance of the system are captured in the Test and Evaluation
Master Plan.
• Further define and refine the functional and data requirements and
document them in the Requirements Document,
• Complete business process reengineering of the functions to be supported
(i.e., verify what information drives the business process, what information
is generated, who generates it, where does the information go, and who
processes it),
• Develop detailed data and process models (system inputs, outputs, and the
process.
• Develop the test and evaluation requirements that will be used to determine
acceptable system performance.
DESIGN PHASE
The design phase involves converting the informational, functional, and network
requirements identified during the initiation and planning phases into unified
design specifications that developers use to script programs during the
development phase. Program designs are constructed in various ways. Using a
11
top-down approach, designers first identify and link major program components
and interfaces, then expand design layouts as they identify and link smaller
subsystems and connections. Using a bottom-up approach, designers first identify
and link minor program components and interfaces, then expand design layouts
as they identify and link larger systems and connections. Contemporary design
techniques often use prototyping tools that build mock-up designs of items such
as application screens, database layouts, and system architectures. End users,
designers, developers, database managers, and network administrators should
review and refine the prototyped designs in an iterative process until they agree
on an acceptable design. Audit, security, and quality assurance personnel should
be involved in the review and approval process. During this phase, the system is
designed to satisfy the functional requirements identified in the previous phase.
Since problems in the design phase could be very expensive to solve in the later
stage of the software development, a variety of elements are considered in the
design to mitigate risk. These include:
DEVELOPMENT PHASE
IMPLEMENTATION PHASE
This phase is initiated after the system has been tested and accepted by the user.
In this phase, the system is installed to support the intended business functions.
System performance is compared to performance objectives established during
the planning phase. Implementation includes user notification, user training,
installation of hardware, installation of software onto production computers, and
integration of the system into daily work processes. This phase continues until
the system is operating in production in accordance with the defined user
requirements.
15
• Determine when the system needs to be modernized, replaced, or retired.
SOURCE CODE
import mysql.connector as m
import math as y
mydb=m.connect(host='localhost',user='root',password='adi@2007',port=3306,data
base='calculator')
mycursor=mydb.cursor()
mycursor.execute('create database if not exists calculator')
16
if math=='add':
m1=v1+v2
mycursor.execute("INSERT INTO CALCULATOR (VALUE_1, VALUE_2,
MATHEMATICAL_OPERATION,RESULT) VALUES (%s, %s, %s,%s)", (v1, v2,'add',m1))
mydb.commit()
if math=='sub':
m2=v1-v2
mycursor.execute("INSERT INTO CALCULATOR (VALUE_1, VALUE_2,
MATHEMATICAL_OPERATION,RESULT) VALUES (%s, %s, %s,%s)", (v1, v2,'sub',m2))
mydb.commit()
if math=='lcm':
m3=y.lcm(v1,v2)
mycursor.execute("INSERT INTO CALCULATOR (VALUE_1, VALUE_2,
MATHEMATICAL_OPERATION,RESULT) VALUES (%s, %s, %s,%s)", (v1, v2,'lcm',m3))
mydb.commit()
if math=='multiply':
m4=v1*v2
mycursor.execute("INSERT INTO CALCULATOR (VALUE_1, VALUE_2,
MATHEMATICAL_OPERATION,RESULT) VALUES (%s, %s, %s,%s)", (v1,
v2,'multiply',m4))
mydb.commit()
if math=='divide':
if v2 ==0:
mj='infinity'
print('infinity')
mycursor.execute("INSERT INTO CALCULATOR (VALUE_1, VALUE_2,
MATHEMATICAL_OPERATION,RESULT) VALUES (%s, %s, %s,%s)", (v1, v2,'divide',mj))
else:
m5=v1/v2
mycursor.execute("INSERT INTO CALCULATOR (VALUE_1, VALUE_2,
MATHEMATICAL_OPERATION,RESULT) VALUES (%s, %s, %s,%s)", (v1, v2,'divide',m5))
mydb.commit()
if math=='remainder':
m6=v1%v2
17
m14=v1**v2
if math=='cube':
m16=v1**3
18
m10=y.floor(v1)
m8=y.cbrt(v1)
19
20
OUTPUT
================================================================
Vs code output:
Sql output:
21
Sql output(2nd):
TESTING
22
Software Testing is an empirical investigation conducted to provide stakeholders
with information about the quality of the product or service under test, with
respect to the context in which it is intended to operate. Software Testing also
provides an objective, independent view of the software to allow the business to
appreciate and understand the risks at implementation of the software. Test
techniques include, but are not limited to, the process of executing a program or
application with the intent of finding software bugs.
It can also be stated as the process of validating and verifying that a software
program/application/product meets the business and technical requirements that
guided its design and development, so that it works as expected and can be
implemented with the same characteristics. Software Testing, depending on the
testing method employed, can be implemented at any time in the development
process, however the most test effort is employed after the requirements have
been defined and coding process has been completed.
TESTING METHODS
Software testing methods are traditionally divided into black box testing and
white box testing. These two approaches are used to describe the point of view
that a test engineer takes when designing test cases.
Black box testing treats the software as a "black box," without any knowledge of
internal implementation. Black box testing methods include: equivalence
partitioning, boundary value analysis, all-pairs testing, fuzz testing, model-based
testing, traceability matrix, exploratory testing and specification-based testing.
23
SPECIFICATION-BASED TESTING
The black box tester has no "bonds" with the code, and a tester's perception is
very simple: a code must have bugs. Using the principle, "Ask and you shall
receive," black box testers find bugs where programmers don't. But, on the other
hand, black box testing has been said to be "like a walk in a dark labyrinth without
a flashlight," because the tester doesn't know how the software being tested was
actually constructed.
That's why there are situations when (1) a black box tester writes many test cases
to check something that can be tested by only one test case, and/or (2) some parts
of the back end are not tested at all. Therefore, black box testing has the advantage
of "an unaffiliated opinion," on the one hand, and the disadvantage of "blind
exploring," on the other.
WHITE BOX TESTING
White box testing, by contrast to black box testing, is when the tester has access
to the internal data structures and algorithms (and the code that implement these)
24
The following types of white box testing exist:
• api testing - Testing of the application using Public and Private APIs.
• Code coverage - creating tests to satisfy some criteria of code
coverage.
For example, the test designer can create tests to cause all statements in the
program to be executed at least once.
• fault injection methods.
• mutation testing methods.
static testing - White box testing includes all static testing
White box testing methods can also be used to evaluate the completeness of a test
suite that was created with black box testing methods. This allows the software
team to examine parts of a system that are rarely tested and ensures that the most
important function points have been tested.
25
V. Hard disk : SATA 40 GB OR ABOVE
SOFTWARE REQUIREMENTS:
• Windows OS
• Python--
• MySQL
REFERENCES
26