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

Cppfinal

The document discusses a micro-project on creating a basic calculator. It provides background information on calculators, including their history and types. A group of 5 students will work on the project under the guidance of their instructor, Mrs. A. H. Jadhav. They will develop a basic calculator and submit a report on their work for their diploma program. The project involves understanding algorithms and implementing the basic arithmetic operations of a calculator.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Cppfinal

The document discusses a micro-project on creating a basic calculator. It provides background information on calculators, including their history and types. A group of 5 students will work on the project under the guidance of their instructor, Mrs. A. H. Jadhav. They will develop a basic calculator and submit a report on their work for their diploma program. The project involves understanding algorithms and implementing the basic arithmetic operations of a calculator.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

GOVERNMENT POLYTECHNIC, AMBAD.

DEPARTMENT OF COMPUTER ENGINEERING


COURSE & CODE-OOP/22316
ACADEMIC YEAR- 2022-23

A MICRO-PROJECT ON
“CREATE A BASIC CALCULATOR”

FOR THE AWARD OF

DIPLOMA IN ENGINEERING & TECHNOLOGY


(COMPUTER ENGINEERING-CO 3I)
UNDER THE GUIDANCE OF
MRS.A.H.JADHAV
SUBMITTED BY

SR.NO ENROLLMENT NO ROLL NO NAME


1. 2111620089 21 NIKITA PRALHAD JADHAV
2. 2111620095 26 ANKITA DIGAMBAR KALYANKAR
3. 2111620107 36 YOGESH SANJAY PAWAR
4. 2111620109 37 ROHAN DEVANAND POKALE
5. DSY 59 NAVNATH VITTHAL BORDE
GOVERNMENT POLYTECHNIC,AMBAD.
DEPARTMENT OF COMPUTER ENGINEERING

CERTIFICATE
This is to certify that the Micro-project entitled “ OBJECT ORIENTED
PROGRAMMING”being submitted here with for the award of DIPLOMA IN ENGINEERING
& TECHNOLOGY in COMPUTER ENGINEERING of MAHARASHTRA STATE BOARD
& TECHNICAL EDUCATION (MSBTE) GOVER NMENT POLYTECNIC,AMBAD is
the result of Micro-project work completed by roll no 21,26,36,37under the supervision and
guidance of
MRS. A.H.JADHAV
It is to the best of my knowledge and belief that the work embodied in this Micro-project has not
formed earlier the basis for the award of any degree or diploma of this or any other Board or
examining body.

Place: GOVERNMENT POLYTECHNIC AMBAD


Date:

Mrs. A . H. JADHAV Mr . BANKAR Dr . A . M . Jinturkar


Micro-project Guide H.O.D Principal
DECLARATION

We, the undersigned hereby declare that the project entitled “CREATE A BASIC
CALCULATOR” is written and submitted by me to Government Polytechnic Ambad during
Year 2022-23, first Semester for partial fulfillment of the ‘Micro Project’ requirement of “
OBJECT ORIENTED PROGRAMMING” course under Maharashtra State Board of
Technical Education, Mumbai curriculum, under the guidance of Mrs.A . H . JADHAV is my
original work.

The empirical findings in this project are based on the collected data and are not copied from any
other sources.

SR.NO ENROLLMENT NO ROLL NO NAME


1. 2111620089 21 NIKITA PRALHAD JADHAV
2. 2111620095 26 ANKITA DIGAMBAR KALYANKAR
3. 2111620107 36 YOGESH SANJAY PAWAR
4. 2111620109 37 ROHAN DEVANAND POKALE
5. DSY 59 NAVNATH VITTHAL BORDE
ACKNOWLEDGEMENTS

We have great pleasure to express my immense gratitude towards a dynamic person and
my project guidance, Mrs. A. H. JADHAV Department of Computer Engeneering Government
Polytechnic, Ambad for giving me an opportunity to work on an interesting topic over one
semester. The work presented here could not have been accomplished without his most
competent and inspiring guidance, incessant encouragement, constructive criticism and constant
motivation during all phases of our group Micro-project work. I am highly indebted to him.
We are very much thankful to Prof. Banker sir, Head Department of Computer

Engeneering, all HODs of various departments and Prof. Dr. A.M.JINTURKAR Sir, The
Principal of Government Polytechnic, Ambad for his encouragement and providing me a
motivating environment and project facilities in the Institute to carry out experiments and
complete this Micro-project work.
We would like to extend my thanks to all our professors, staff members and all our
friends who extended their co-operation to complete the project.
We are indeed indebted to my parents and other family members for their
immense help at all levels with moral, social & financial support, care and support
throughout my studies without which my work would not have seen light of the day.
With warm regard Yours Sincerely,

NIKITA PRALHAD JADHAV


ANKITA DIGAMBAR KALYANKAR
YOGESH SANJAY PAWAR
ROHAN DEVANAND POKALE
NAVNATH VITTHAL BORDE
Place: Ambad
Date:

GOVERNMENT POLYTECHNIC, AMBAD.


DEPARTMENT OF COMPUTER ENGENEERING
COURSE & CODE-OOP/22316
ACADEMIC YEAR- 2022-23
A MICRO-PROJECT ON
“BASIC CALCULATOR”
(COMPUTER ENGINEERING-CO 3I)

INDEX
SRN TOPIC NAME SUBTOPIC NAME
O
1. INTRODUCTION WHAT IS CALCULATOR?
HISTORY OF CALCULATOR?

2. TYPES OF BASIC,SCIENTIFIC,GRAPHICS,MEMORY,FINANCIAL
CALCULATOR etc,CALCULATOR IMAGE.

BENEFITS OF USES OF CALCULATOR IN REGULAR AS WELL AS


CALCULATOR STUDENT LIFE.

4. ALGORITHM STEP BY STEP


THEROTICAL REPRESENT OF PROGRAM

INTRODUCTION:
What is a calculator?
A calculator is a device that performs arithmetic operations on numbers. Basic
calculators can do only addition, subtraction, multiplication and division
mathematical calculations.

However, more sophisticated calculators can handle exponential operations, square


roots, logarithms, trigonometric functions and hyperbolic functions. Internally,
some calculators perform all these functions by repeated addition processes.
The evolution of the calculator
Most calculators these days require electricity to operate or are battery-powered
calculators. Calculators work by performing programmed functions based on
numerical inputs.

Before the electronic calculator (circa 1970), a more primitive calculator, the slide
rule, was commonly used. It consisted of a slat of wood called the slide that could
be moved in and out of a reinforced pair of slats. Both the slide and the outer pair
of slats had calibrated numerical scales.

History of Calculator:

The importance of this helpful tool was known in the early times. At that time,
early men use bones, pebbles and other objects to tally the calculations.

But, it was very limited in nature. So, when the first mainframe computers came
into existence. It was using vacuum tubes and transistors. That leads to stepping
stones to develop an electronic calculator.

Therefore, the first electronic calculator was launched by Casio computer


company in 1957. followed by a series of models with compact technology. Some
leading manufactures opted for this technology to cover this new market. Like
Canon, Sony, Toshiba, Olivetti, etc.
Types of calculators:
Calculators have evolved over the last several decades. Today, there are a variety
of calculators, from brands such as Casio and Texas Instruments, available to serve
different mathematical needs. Let's look at a few of them.

Basic calculators:
The most basic calculator is the four-function calculator, which can perform basic
arithmetic such as addition, subtraction, multiplication and division.

These are sometimes called pocket calculators or hand-held electronic calculators


because they are small enough to fit in a shirt pocket. They are also the least
expensive calculator, costing around $5 or less.
Four-function calculators usually have a +, -, x and / sign to denote the operations
and can produce decimal numbers. Some also have a % button, which is used to
calculate percentages.

Scientific calculators:
As its name suggests, the scientific calculator is designed for performing scientific
calculations.

This type of calculator usually has more buttons than a standard calculator, as it
needs to be able to perform trigonometric functions, logarithms, sine/cosine and
exponential operations.

The scientific calculator also usually has a larger display to view long equations
and see more digits at a time.

Graphing calculators:
The next type of calculator is the graphing calculator. The graphing calculator is
similar to the scientific calculator in that it can perform many of the same
operations.

However, the graphing calculator also can graph equations, for example, with more
advanced mathematics like trigonometry, on a coordinate plane. This is a valuable
tool for visual learners or those studying mathematics that requires a lot of
graphing, such as calculus.

Financial calculators:
The last type of calculator we will discuss is the financial calculator. The financial
calculator is an electronic device

designed for solving financial problems and uses paper tape to print calculations
for hard-copy record-keeping.

This calculating machine can usually compute the present, future, rate of return
and other critical financial concepts such as return on investment. Financial
calculators are essential for anyone studying finance or working in the financial
industry.
Memory Calculators:
Calculators also have the ability to store numbers into computer memory. Basic
calculators usually store only one number at a time; more specific types are able to
store many numbers represented in variables. The variables can also be used for
constructing formulas. Some models have the ability to extend memory capacity to
store more numbers; the extended memory address is termed an array index.
Power source
Power sources of calculators are batteries, solar cells or mains electricity (for old
models), turning on with a switch or button. Some models even have no turn-off
button but they provide some way to put off (for example, leaving no operation for
a moment, covering solar cell exposure, or closing their lid). Crank-powered
calculators were also common in the early computer era.
This program takes an operator and two operands from the user.

The operator is stored in variable op and two operands are stored in num1 and
num2 respectively.

Then, switch...case statement is used for checking the operator entered by user.

If user enters + then, statements for case: '+' is executed and program is terminated.

If user enters - then, statements for case: '-' is executed and program is terminated.

This program works similarly for the * and / operators. But, if the operator doesn't
matches any of the four character [ +, -, * and / ], the default statement is executed
which displays error message.
This program takes an operator and operands from the user.

The operator is stored in variable op and operands are stored in num1 and
num2.....num n respectively.

Then, switch...case statement is used for checking the operator entered by user.

If user enters + then, statements for case: '+' is executed and program is terminated.

If user enters - then, statements for case: '-' is executed and program is terminated.
This program works similarly for the * and / operators. But, if the operator doesn't
matches any of the four character [ +, -, * and / ], the default statement is executed
which displays error message.
A calculator is a portable device that helps to perform simple mathematical
calculations in our daily lives such as addition, subtraction, division,
multiplication, etc. Some of the scientific calculators are used to perform complex
calculation more easily like square root, function, exponential operations,
logarithm, trigonometric function and hyperbolic function, etc. In this section, we
will create calculator program in C++ using function and do-while loop.

Benefits of Calculator:
For complex calculations, the use of computers may be quite beneficial.
Students may save a lot of time by using a calculator in class to perform simple
arithmetical calculations.

By doing so, they are able to focus their attention more on critical math topics
rather than on the more fundamental tasks.

Students are required to master the fundamentals of operational arithmetic by


the time they reach middle or high school. Additionally, they must be capable of
performing their own calculations. After all, they’d already mastered this skill in
their earlier sessions, when they were taught the exact same thing.

In other words, allowing students to use calculators in middle and high school is a
win-win situation. As a result, the usage of calculators in middle and high schools
for calculations has a positive effect on students’ learning outcomes.

A student’s technical understanding can be improved by using a calculator.

If you look back, calculators may appear to be overly easy, but when you examine
them closely, you’ll discover that they take some technical expertise to use
effectively, especially when it comes to scientific calculators.

Therefore, middle school kids should be taught how to use a calculator in a


variety of ways.

Calculators are more accurate than humans when it comes to doing


computations.

Calculators may greatly enhance the precision of computations. Another


consideration is the rate of change. The answer can be found in a split second
with the help of a calculator.
PROGRAM:

#include <iostream.h>
#include <math.h>
class Calculator
{
int i, g[20], n;

public:
void result()
{
cout << " Enter The Size of an Elements :";

cin >> n;
cout << " Enter *" <<n<<"* Elements:";

for (i = 0; i < n; i++)


{
cin >> g[i];
}
}

float add()
{
int sum = 0;
for (i = 0; i < n; i++)
{
sum = sum + g[i];
}
return sum;
}
float sub()
{
float sub = g[0];
for (i = 0; i < n-1; i++)
{
sub = sub - g[i + 1];
}
return (sub);
}

float mul()
{
int mul = 1;
for (i = 0; i < n; i++)
{

mul = mul * g[i];


}

return (mul);
}

float div()
{
if (g[0] == 0)
{
cout << " \ndivide by 0";
}
else
{
float div = g[0];
for (i = 0; i < n - 1; i++)
{
div = div / g[i + 1];
}
return div;

}
}
float square()
{
int m;
cout << "**Enter The Number For Square**: ";
cin >> m;
return (m * m);
}
float cube()
{
int m;

cout << "*Enter The Number For Cube*";


cin >> m;
return (m * m * m);
}
float mod()
{
int mod = g[0];
for (i = 0; i < n - 1; i++)
{
mod = mod % g[i + 1];
}
return mod;
}
};

// Driver code
int main()
{
int ch;

Calculator c;
cout << "**Enter '1' for Addition of numbers**";
cout << "\n**Enter '2' for subtraction of numbers**";
cout << "\n**Enter '3'for multiplication of numbers**";

cout << "\n**Enter '4' for division of Numbers**";


cout << "\n**Enter '5' for square of number**";
cout << "\n**Enter '6' for cube of number**";
cout << "\n**Enter '7' for modulas of number**";
cout << "\n***Enter '0' To Exit**";

while(1)
{
cout << "\n**Enter Choice**: ";
cin >> ch;
switch (ch)
{
case 0:cout<<"Exit Successfully!! :";
break;
case 1:

c.result();

cout << "Result:: " << c.add() << endl;


break;
case 2:

c.result();
cout << "Result:: " << c.sub() << endl;
break;
case 3:

c.result();

cout << "Result:: " << c.mul() << endl;


break;
case 4:

c.result();

cout << "Result::" << c.div() << endl;


break;
case 5:
int p;
p=c.square();
cout<<"Result ::" <<p<<endl;
break;

case 6:

int q;
q=c.cube();
cout<<"Result::" <<q<<endl;
break;
case 7:
c.result();
cout << "Result::" << c.mod() << endl;
break;

default:
cout << "!!!Enter Valid Choice !!!";

return 0;
}
OUTPUT:
Algorithm:

step1.start
step2.declare int ch;
step3.print statements.
Enter 1 to Add Numbers
Enter 2 to Substract Numbers
Enter 3 to Multiply Numbers
Enter 4 to Divide Numbers
enter 5 to square
enter 6 for cube
enter 7 for mod
Enter 0 To Exit
step 4.print statement
Enter the choice!!!!!!
Case 1: call to result,and enter the size of elments
And enter the elements .then call to add
For i=0 ,and repet the loop until i<n and then
Sum=sum+g[i] then print addition then break.

Case 2: call to result,and enter the size of elments

And enter the elements .then call sub


For i=0 ,and repet the loop until i<n and then
Sub=g[i]-sub then print substraction then break.
Case 3: call to result,and enter the size of elments
And enter the elements .then call mul.
For i=0 ,and repet the loop until i<n and then
mul=mul*g[i] then print multiplication

Case 4: call to result,and enter the size of elments


And enter the elements .then call div
For i=0 ,and repet the loop until i<n and then
div=div+g[i+1] then print division then break.
Case 5: call to square
And enter the element for find square .
Print the m *m for square then break.
Case 6: call to cube
And enter the elements for find cube .
Print the m *m *m for cube then break.

Case 7: call to result,and enter the size of elments

And enter the elements .then call mod.


For i=0 ,and repet the loop until i<n and then
mod=mod%g[i+1] then print modulus then break
default : print “enter valid choice!!!!!!!!!!!!!!”

step 5.stop
CONCLUSION:
This program takes an operator and operands from the user.
The operator is stored in variable op and operands are stored in num1 and
num2.....num n respectively.
Then, switch...case statement is used for checking the operator entered by user.
If user enters + then, statements for case: '+' is executed and program is terminated.
If user enters - then, statements for case: '-' is executed and program is terminated.
This program works similarly for the * and / operators. But, if the operator doesn't
matches any of the four character [ +, -, * and / ], the default statement is executed
which displays error message.

REFERENCE:
1.https://www.techtarget.com/whatis/definition/calculator.
2.https://en.wikipedia.org/wiki/Mechanical_calculator.
3.https://www.ipl.org/essay/Importance-Of-Calculator-PJLLEGZT
4.OOP REFERENCE BOOK-MCGRAW HILL

THANK YOU!!!!!!

You might also like