Calculator Java
Calculator Java
AN INTERNSHIP
PROJECT REPORT
Submitted by
SURATHUL KAMILA S
Register No. 952621104039
BACHELOR OF ENGINEERING
IN
AUGUST 2024
S.VEERASAMY CHETTIAR COLLEGE OF ENGINEERING
AND TECHNOLOGY
ANNA UNIVERSITY: CHENNAI- 600 025
BONAFIDE CERTIFICATE
Miss.Janani Mr.
Firstly, I express my heartiest thanks and gratefulness to almighty God for His divine
blessing makes us possible to complete the project work successfully.
I would like to express my heartiest gratitude to Mr.xxxxxx, Department of CSE, for his
kind help to finish my project.
I would also generously welcome each one of those individuals who have helped me
straight forwardly or in a roundabout way in making this project a win. In this unique
situation, I might want to thank the various staff individuals, both educating and non-
instructing, which have developed their convenient help and facilitated my undertaking.
Finally, I must acknowledge with due respect the constant support and patients of my
parents.
SURATHUL KAMILA S
(952621104039)
TABLE OF CONTENTS
CERTIFICATE
AKCNOWLEDGEMENT
TABLE OF CONTENTS
ABSTRACT 5
CHAPTER 1 COMPANY PROFILE 6
CHAPTER 2 WEEKLY OVERVIEW OF INTERNSHIP ACTIVITIES 8
CHAPTER 3 INTRODUCTION 10
CHAPTER 4 SYSTEM SPECIFICATION 13
CHAPTER 5 TECHNOLOGY LEARNT 14
CHAPTER 6 PROJECT DESCRIPTION 15
CHAPTER 7 CODING 17
CHAPTER 8 RESULTS 26
CHAPTER 9 CONCLUSION 27
CHAPTER 10 REFERENCES 28
CALCULATOR USING JAVA
ABSTRACT
VISION:
Be a global force in innovative solutions, quality excellence and redefine
creative thoughts. Striving to be a global force in innovative solutions, quality
excellence, and the redefinition of creative thoughts, we embark on a journey
that transcends boundaries. Our commitment extends beyond mere problem-
solving; it encompasses a vision to reshape industries and leave an indelible
mark on the global landscape. At the core of our mission is a relentless pursuit
of innovation, where we challenge the status quo and push the limits of what is
conceivable
MISSION:
We endeavour to bring innovative solutions to the forefront, employing
a simple yet effective approach that underscores our commitment to providing
deserving quality. Our mission is rooted in a dedication to pushing the
boundaries of what's possible, embracing creativity, and maintaining a relentless
pursuit of excellence. By adhering to these principles, we aim to not only meet
but exceed the expectations of our users, clients, and partners. Through a
combination of forward-thinking strategies and a focus on quality, we strive to
make a meaningful impact in every endeavour we undertake.
OUR SERVICES
WEBSITE DEVELOPMENT
E-COMMERCE
WORDPRESS DEVELOPMENT
OUTSOURCING
CLOUD SERVICES
DIGITAL MARKETING
SEO
COLLEGE PROJECT
INTERNSHIP
SOFTWARE TRAINING
CHAPTER 2
WEEKLY OVERVIEW OF INTERNSHIP
ACTIVITIES
CHAPTER 3
INTRODUCTION
Calculators are used widely in any situation where quick access to certain
mathematical functions is needed, especially those that were once looked up in
tables, they are also used in situations requiring calculations of very large or
very small numbers, as in some aspects of Astronomy, Physics and
Chemistry.
They are very often required for math classes from the junior high school level
through college, and are generally either permitted or required on many
standardized tests covering math and science subjects; as a result, many are sold
into educational markets to cover this demand, and some high-end models
include features making it easier to translate a problem on a
textbook page into calculator input, e.g. by providing a method to
enter an entire problem in as it is written on the page using simple formatting
tools.
1.1Internship Objectives
Internships are generally thought of to be reserved for college students looking
to gain experience in a particular field. However, a wide array of people can
benefit from Training Internships in order to receive real world experience and
develop their skills.
An objective for this position should emphasize the skills you already possess in
the area and your interest in learning more
Internships are utilized in a number of different career fields, including
architecture, engineering, healthcare, economics, advertising and many more.
Some internship is used to allow individuals to perform scientific research while
others are specifically designed to allow people to gain first-hand experience
working.
Utilizing internships is a great way to build your resume and develop skills that
can be emphasized in your resume for future jobs. When you are applying for a
Training Internship, make sure to highlight any special skills or talents that can
make you stand apart from the rest of the applicants so that you have an
improved chance of landing the position.
SYSTEM REQUIREMENTS
Software Requirements:
Text Editor : Visual Studio.
Language : JAVA.
Operating System : Windows 10.
Hardware Requirements:
Processor : Intel core i3
Memory : 8GB RAM
Hard Disk : 1TB
CHAPTER 5
TECHNOLOGY LEARNT
JAVA
Java is used to develop mobile apps, web apps, desktop apps, games and
much more.
CHAPTER 6
PROJECT DESCRIPTION
Calculators are used widely in any situation where quick access to certain
mathematical functions is needed, especially those that were once looked up in
tables, they are also used in situations requiring calculations of very large or
very small numbers, as in some aspects of Astronomy, Physics and
Chemistry. They are very often required for math classes from the junior high
school level through college, and are generally either permitted or
required on many standardized tests covering math and science subjects; as a
result, many are sold into educational markets to cover this demand, and some
high-end models include features making it easier to translate a
problem on a textbook page into calculator input, e.g. By providing
a method to enter an entire problem in as it is written on the page using
simple formatting tools.
Java Server
Existing System
Proposed System
Modern scientific calculators have many more capabilities than the original
four- or five-function calculator. These capabilities include scientific notation,
logarithmic functions, trigonometric functions, exponential functions, and more.
Software calculators can provide accurate results without the risk of human
error. This is especially important in financial planning, where even small errors
can have a big impact.
CHAPTER 7
CODING
import java.awt.*;
import java.awt.event.*;
/*********************************************/
String digitButtonText[] = {"7", "8", "9", "4", "5", "6", "1", "2", "3", "0", "+/-", "." };
String operatorButtonText[] = {"/", "sqrt", "*", "%", "-", "1/X", "+", "=" };
String memoryButtonText[] = {"MC", "MR", "MS", "M+" };
String specialButtonText[] = {"Backspc", "C", "CE" };
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent ev)
{System.exit(0);}
});
setLayout(null);
setSize(FRAME_WIDTH,FRAME_HEIGHT);
setVisible(true);
}
//////////////////////////////////
static String getFormattedText(double temp)
{
String resText=""+temp;
if(resText.lastIndexOf(".0")>0)
resText=resText.substring(0,resText.length()-2);
return resText;
}
////////////////////////////////////////
public static void main(String []args)
{
new MyCalculator("Calculator - JavaTpoint");
}
}
/*******************************************/
//////////////////////////////////////////
MyDigitButton(int x,int y, int width,int height,String cap, MyCalculator clc)
{
super(cap);
setBounds(x,y,width,height);
this.cl=clc;
this.cl.add(this);
addActionListener(this);
}
////////////////////////////////////////////////
static boolean isInString(String s, char ch)
{
for(int i=0; i<s.length();i++) if(s.charAt(i)==ch) return true;
return false;
}
/////////////////////////////////////////////////
public void actionPerformed(ActionEvent ev)
{
String tempText=((MyDigitButton)ev.getSource()).getLabel();
if(tempText.equals("."))
{
if(cl.setClear)
{cl.displayLabel.setText("0.");cl.setClear=false;}
else if(!isInString(cl.displayLabel.getText(),'.'))
cl.displayLabel.setText(cl.displayLabel.getText()+".");
return;
}
int index=0;
try{
index=Integer.parseInt(tempText);
}catch(NumberFormatException e){return;}
if(cl.setClear)
{cl.displayLabel.setText(""+index);cl.setClear=false;}
else
cl.displayLabel.setText(cl.displayLabel.getText()+index);
}//actionPerformed
}//class defination
/********************************************/
cl.setClear=true;
double temp=Double.parseDouble(cl.displayLabel.getText());
if(opText.equals("1/x"))
{
try
{double tempd=1/(double)temp;
cl.displayLabel.setText(MyCalculator.getFormattedText(tempd));}
catch(ArithmeticException excp)
{cl.displayLabel.setText("Divide by 0.");}
return;
}
if(opText.equals("sqrt"))
{
try
{double tempd=Math.sqrt(temp);
cl.displayLabel.setText(MyCalculator.getFormattedText(tempd));}
catch(ArithmeticException excp)
{cl.displayLabel.setText("Divide by 0.");}
return;
}
if(!opText.equals("="))
{
cl.number=temp;
cl.op=opText.charAt(0);
return;
}
// process = button pressed
switch(cl.op)
{
case '+':
temp+=cl.number;break;
case '-':
temp=cl.number-temp;break;
case '*':
temp*=cl.number;break;
case '%':
try{temp=cl.number%temp;}
catch(ArithmeticException excp)
{cl.displayLabel.setText("Divide by 0."); return;}
break;
case '/':
try{temp=cl.number/temp;}
catch(ArithmeticException excp)
{cl.displayLabel.setText("Divide by 0."); return;}
break;
}//switch
cl.displayLabel.setText(MyCalculator.getFormattedText(temp));
//cl.number=temp;
}//actionPerformed
}//class
/****************************************/
/////////////////////////////////
MyMemoryButton(int x,int y, int width,int height,String cap, MyCalculator clc)
{
super(cap);
setBounds(x,y,width,height);
this.cl=clc;
this.cl.add(this);
addActionListener(this);
}
public void actionPerformed(ActionEvent ev)
{
char memop=((MyMemoryButton)ev.getSource()).getLabel().charAt(1);
cl.setClear=true;
double temp=Double.parseDouble(cl.displayLabel.getText());
switch(memop)
{
case 'C':
cl.memLabel.setText(" ");cl.memValue=0.0;break;
case 'R':
cl.displayLabel.setText(MyCalculator.getFormattedText(cl.memValue));break;
case 'S':
cl.memValue=0.0;
case '+':
cl.memValue+=Double.parseDouble(cl.displayLabel.getText());
if(cl.displayLabel.getText().equals("0") || cl.displayLabel.getText().equals("0.0") )
cl.memLabel.setText(" ");
else
cl.memLabel.setText("M");
break;
}//switch
}//actionPerformed
}//class
/*****************************************/
//////////////////////////////////////////////////////////
public void actionPerformed(ActionEvent ev)
{
String opText=((MySpecialButton)ev.getSource()).getLabel();
//check for backspace button
if(opText.equals("Backspc"))
{
String tempText=backSpace(cl.displayLabel.getText());
if(tempText.equals(""))
cl.displayLabel.setText("0");
else
cl.displayLabel.setText(tempText);
return;
}
//check for "C" button i.e. Reset
if(opText.equals("C"))
{
cl.number=0.0; cl.op=' '; cl.memValue=0.0;
cl.memLabel.setText(" ");
}
CHAPTER 8
RESULTS
CHAPTER 9
CONCLUSION
We think this project or desktop application is helpful for all those who
really need it. We can use this application in everywhere for small and
large as well as complex calculations. In this project we have started our
experience about a programming and handling programming. But to a great
extern due to coordinate of the faculty members it has been possible for me
to complete this project “CALCULATOR”. Finally we are grateful to
my respected teachers for extending their support and valuable guidance.
FUTURE ENHANCEMENT
CHAPTER 10
REFERENCES
https://www.w3schools.com/java/java_intro.asp
https://ieeexplore.ieee.org/document/475332
https://ieeexplore.ieee.org/xpl/RecentIssue.jsp?punumber=85
https://ieeexplore.ieee.org/xpl/conhome/9648913/proceeding