You are on page 1of 9

(Department of Mechnical Engineering)

Mini Project Report on


Digital Calculator
Using JAVA Programming

By
Group – ‘B3’
Department of Mechanical, REC

Slno. Nameof the student Roll.No.


1. B SURESH KRISHNA 17981A0335
2. G PREM CHANDU 17981A03A3
3. D RAMESH 17981A0358
4. D MANOHAR 17981A0371
5. K GOVARDHAN 17981A03E2
6. S,BALAKRISHNA 17981A03M9

Under the Guidance of


Mr. B.S.Venkata Reddy, M.Tech,(Ph.D) ,MBA.

Assistant Professor, Department of CSE,


RAGHU ENGINEERING COLLEGE
YEAR : 2019-20
RAGHU ENGINEERING COLLEGE
(Department of Mechnical Engineering and Civil Engineering)

Mini Project Report on


Digital Calculator
Using JAVA Programming

Submitted by

STUDENT REGISTER NUMBER :


NAME OF THE STUDENT :
NAME OF THE BRANCH :
DATE OF SUBMISSION :

ACADEMIC YEAR : Signature of the student


--------------------------------------------------------------------------------------------------------------------------
Details of the Guided :
Name : B.S.Venkata Reddy
Desig. : Asst. Professor
Department : CSE, REC. Signature of the guide
--------------------------------------------------------------------------------------------------------------------------

Signature of External Signature of HOD

:
Digital Calculator

CONTENTS

Contents Page-No.
Project Description/Introduction...................................<1>
Proposed system ...........................................................< 1>
Software and Hardware Requirements .........................< 2>
Source Code in JAVA ....................................................< 2>
Input And Output S Of The Project .............................. <8>
References .................................................................... <9>
Digital Calculator
Project Description :
Introduction :
You're probably used to the idea that your computer screen makes letters and
numbers using a tiny grid of dots called pixels. Early computers used just a
few pixels and looked very dotty and grainy, but a modern LCD screen uses
millions of pixels and is almost as clear and sharp as a printed book.
Calculators, however, remain stuck in the dark ages—or the early 1970s, to
be precise. Look closely at the digits on a calculator and you'll see each one is
made from a different pattern of seven bars or segments. The processor chip
knows it can display any of the numbers 0-9 by activating a different
combination of these seven segments.

A calculator is a device that performs arithmetic operations on numbers. The


simplest calculators can do only addition, subtraction, multiplication, and division.
More sophisticated calculators can handle exponent ial operations, roots, logarithm
s, trigonometric functions, and hyperbolic functions.

Proposed system :This Digiatl Calculator project is helps the users to compute the
numirical operations on numbers(0-9) within the time and also get the acurate results
without any errors. Hence save the user time and get the results effectively .
This project prototype model , we named as “Digital Calculator” .
In this Project , they are two modules :
1. Enter the digits on text Box by pressing number-keys which is palced on Container .
2. Press or select the Operatotor –key to perform operation
3. Again Enter the nuw digits on the same text Box by pressing number-keys which is
palced on Container .
4. Click on “=” key (Press or select =key) to get the results either +. -, /, x.
Digital Calculator
Software and Hardware Requirements :
Technology : Java Version : jdk-1.8.0_131
Operating System : MS-Windows and MS-DOS
Hardware : Desktop /Laptop (any model )
RAM : 1 GB
HARDDISK : 1GB OR ABOVE .

Source Code in JAVA :


import java.awt.*;
import java.awt.event.*;
import java.applet.*;

/*<applet code = "CALCULATOR.class" width = 260 height = 310></applet>*/

public class CALCULATOR extends Applet implements ActionListener


{
TextField t1;
Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b0;
Button add,sub,mul,div, eql, dot;
String msg="",tmp;
int a, b;
public void init()
{
setLayout(null);
t1=new TextField(20);
b1=new Button("1");
b2=new Button("2");
b3=new Button("3");
b4=new Button("4");
b5=new Button("5");
b6=new Button("6");
b7=new Button("7");
b8=new Button("8");
b9=new Button("9");
b0=new Button("0");
add=new Button("+");
sub=new Button("-");
div=new Button("/");
mul=new Button("*");
dot=new Button(".");
eql=new Button("=");

add(t1);
add(b7);
add(b8);
add(b9);
add(div);

add(b4);
add(b5);
add(b6);
add(mul);

add(b1);
add(b2);
add(b3);
add(sub);

add(dot);
add(b0);
add(eql);
add(add);

t1.setBounds(30,30,200,40);

b7.setBounds(30,80,44,44);
b8.setBounds(82,80,44,44);
b9.setBounds(134,80,44,44);

b4.setBounds(30,132,44,44);
b5.setBounds(82,132,44,44);
b6.setBounds(134,132,44,44);

b1.setBounds(30,184,44,44);
b2.setBounds(82,184,44,44);
b3.setBounds(134,184,44,44);

dot.setBounds(30,236,44,44);
b0.setBounds(82,236,44,44);
eql.setBounds(134,236,44,44);
add.setBounds(186,236,44,44);
sub.setBounds(186,184,44,44);
mul.setBounds(186,132,44,44);
div.setBounds(186,80,44,44);

b0.addActionListener(this);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
//b0.addActionListener(this);
//b0.addActionListener(this);
div.addActionListener(this);
mul.addActionListener(this);
add.addActionListener(this);
sub.addActionListener(this);
eql.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String str = ae.getActionCommand();
if (str.equals("+")||str.equals("-")||str.equals("*")||str.equals("/"))
{
String str1 = t1.getText();
tmp=str;
a = Integer.parseInt(str1);
msg="";
}
else if(str.equals("="))
{
String str2 = t1.getText();
b = Integer.parseInt(str2);
int sum=0;
if(tmp=="+")
sum=a+b;
else if(tmp=="-")
sum=a-b;
else if(tmp=="*")
sum=a*b;
else if(tmp=="/")
sum=a/b;
String str1=String.valueOf(sum);
t1.setText(""+str1);
msg="";
}
else
{
//String ae.getActionCommand();
//str += ae.getActionCommand();
msg+=str;
t1.setText(""+msg);
}
}
public void paint(Graphics g)
{
g.setColor(Color.cyan);
g.fillRect(20,20,220,270);
}
}

====== X X X END OF THE CODE X X X =====

OUTPUTS OF THE PROJECT :


References :

1.The complete Reference Java, 8th edition, Herbert Schildt, TMH.


2. Programming in JAVA, Sachin Malhotra, SaurabhChoudary, Oxford.
3. Introduction to java programming, 7th edition by Y Daniel Liang, Pearson.
4.http://www.javatpoint.com and google.com,etc

You might also like