Professional Documents
Culture Documents
Final Ajp Project
Final Ajp Project
Final Ajp Project
1. Brief Description :
In this project we have created a calculator using a java program. This project helps
students to learn about different java functions .This project students will learn how to create a
calculator using a java program. A calculator is used to perform different functions like addition,
substraction, multiplication, substraction, etc. .Each and every calculator has a IC in it in which
program is bursted.
4. Proposed Methodology :
1
1. Focused on selection of appropriate topic for micro-project.
2. Select the topic i.e. Calculator using Java program.
3. Brief study as well as a survey on our topic .
4. Gather all information based on the topic of micro project.
5. Analysis and study of our topic in detail.
6. Following all the above methodologies we successfully completed with our
microproject.
5. Action plan :
Name of
Sr. Planned Planned Responsible
Details of Activity
No. start Date Finish Date Team
Members
Gathering The Raw
25.08.2020 01.09.2020
1. Information Related
3:00 to 5:00 3:00 to 5:00
To Project
03.09.2020 05.09.2020
2. Analysis
3:00 to 5:00 3:00 to 5:00 Fere Rahul
14.09.2020 21.09.2020
3. Designing
3:00 to 5:00 3:00 to 5:00 Wakade Pavan
22.09.2020 04.10.2020
4. Implement of Coding
3:00 to 5:00 3:00 to 5:00 Maske
5.10.2020 15.10.2020 Shubham
5. Testing of Project
3:00 to 5:00 3:00 to 5:00
18.10.2020 25.10.2020 Gaikwad
6. Deployment of Module
3:00 to 5:00 3:00 to 5:00 Shubham
1.11.2020 08.11.2020
7. Prepare Out Put
3:00 to 5:00 3:00 to 5:00
Prepare Report on 20.11.2020 30.11.2020
8.
Micro Project 3:00 to 5:00 3:00 to 5:00
6. Resources Used :
2
Sr.
No Name of Specification Quantity Remark
Resource/Material s
1 Personal computer Processor: Ryzen 3 3200g. Ram: 8GB
DDR4 3133MHz, HDD: 512GB
1 ____
2 Internet 10mbps BSNL LAN Network __ __
3 Java Development __ JDK is
Kit, Java Virtual the basic
Machine Java compiler java
compiler
(JDK , JVM) , which is
Notepad++ with very
nppexec plugin to easy to
compile and run use.
3
1. Rationale :
An electronic calculator is typically a portable electronic device used to
perform calculations, ranging from basic arithmetic to complex mathematics.
2. Brief Description :
The first solid-state electronic calculator was created in the early 1960s. Pocket-sized devices
became available in the 1970s, especially after the Intel 4004, the first microprocessor, was
developed by Intel for the Japanese calculator company Busicom. They later became used commonly
within the petroleum industry (oil and gas).
Modern electronic calculators vary from cheap, give-away, credit-card-sized models to sturdy
desktop models with built-in printers. They became popular in the mid-1970s as the incorporation
of integrated circuits reduced their size and cost. By the end of that decade, prices had dropped to the
point where a basic calculator was affordable to most and they became common in schools.
In addition to general purpose calculators, there are those designed for specific markets. For
example, there are scientific calculators which include trigonometric and statistical calculations.
Some calculators even have the ability to do computer algebra. Graphing calculators can be used to
graph functions defined on the real line, or higher-dimensional Euclidean space. As of 2016, basic
calculators cost little, but scientific and graphing models tend to cost more.
4
One of the most primitive calculators, the abacus is still used in some regions of the Far East. The
abacus uses groups of beads to denote numbers. Like the slide rule, the abacus requires no source of
power. The beads are positioned in several parallel rows, and can be moved up and down to denote
arithmetic operations. It is said that a skilled abacus user can do some calculations just as fast as a
person equipped with a battery-powered calculator.
As calculators became more advanced during the 1970s, they became able to make computations
involving variables (unknowns). These were the first personal computers. Today's personal
computers can still perform such operations, and most are provided with a virtual calculator program
that actually looks, on screen, like a handheld calculator. The buttons are actuated by pointing and
clicking.
Display output
5
5. Actual methodology followed :
Code :
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" };
6
Label memLabel=new Label(" ",Label.RIGHT);
MyCalculator(String frameText)
{
super(frameText);
tempX=TOPX;
y=TOPY+2*(HEIGHT+V_SPACE);
for(int i=0; i<memoryButton.length; i++)
{
memoryButton[i]=new MyMemoryButton(tempX,y,WIDTH,HEIGHT,memoryButtonText[i], this);
memoryButton[i].setForeground(Color.RED);
y+=HEIGHT+V_SPACE;
}
7
tempX=TOPX+1*(WIDTH+H_SPACE); y=TOPY+1*(HEIGHT+V_SPACE);
for(int i=0;i<specialButton.length;i++)
{
specialButton[i]=new MySpecialButton(tempX,y,WIDTH*2,HEIGHT,specialButtonText[i], this);
specialButton[i].setForeground(Color.RED);
tempX=tempX+2*WIDTH+H_SPACE;
}
int digitX=TOPX+WIDTH+H_SPACE;
int digitY=TOPY+2*(HEIGHT+V_SPACE);
tempX=digitX; y=digitY;
for(int i=0;i<digitButton.length;i++)
{
digitButton[i]=new MyDigitButton(tempX,y,WIDTH,HEIGHT,digitButtonText[i], this);
digitButton[i].setForeground(Color.BLUE);
tempX+=WIDTH+H_SPACE;
if((i+1)%3==0){tempX=digitX; y+=HEIGHT+V_SPACE;}
}
int opsX=digitX+2*(WIDTH+H_SPACE)+H_SPACE;
int opsY=digitY;
tempX=opsX; y=opsY;
for(int i=0;i<operatorButton.length;i++)
{
tempX+=WIDTH+H_SPACE;
operatorButton[i]=new MyOperatorButton(tempX,y,WIDTH,HEIGHT,operatorButtonText[i], this);
8
operatorButton[i].setForeground(Color.RED);
if((i+1)%2==0){tempX=opsX; y+=HEIGHT+V_SPACE;}
}
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent ev)
{System.exit(0);}
});
setLayout(null);
setSize(FRAME_WIDTH,FRAME_HEIGHT);
setVisible(true);
}
9
class MyDigitButton extends Button implements ActionListener
{
MyCalculator cl;
if(tempText.equals("."))
{
if(cl.setClear)
10
{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);
}
}
11
this.cl=clc;
this.cl.add(this);
addActionListener(this);
}
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;
12
}
if(!opText.equals("="))
{
cl.number=temp;
cl.op=opText.charAt(0);
return;
}
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;
}
cl.displayLabel.setText(MyCalculator.getFormattedText(temp));
}
13
}
cl.setClear=true;
double temp=Double.parseDouble(cl.displayLabel.getText());
switch(memop)
{
case 'C':
cl.memLabel.setText(" ");cl.memValue=0.0;break;
14
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;
}
}
}
class MySpecialButton extends Button implements ActionListener
{
MyCalculator cl;
MySpecialButton(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 String backSpace(String s)
{
String Res="";
for(int i=0; i<s.length()-1; i++) Res+=s.charAt(i);
15
return Res;
}
if(opText.equals("Backspc"))
{
String tempText=backSpace(cl.displayLabel.getText());
if(tempText.equals(""))
cl.displayLabel.setText("0");
else
cl.displayLabel.setText(tempText);
return;
}
if(opText.equals("C"))
{
cl.number=0.0; cl.op=' '; cl.memValue=0.0;
cl.memLabel.setText(" ");
}
cl.displayLabel.setText("0");cl.setClear=true;
}
}
Output :
16
_________________________________________________________________________________
6. Action plan :
17
Name of
Sr. Planned Planned Responsible
Details of Activity
No. start Date Finish Date Team
Members
Gathering The Raw
25.08.2020 01.09.2020
1. Information Related
3:00 to 5:00 3:00 to 5:00
To Project
03.09.2020 05.09.2020
2. Analysis
3:00 to 5:00 3:00 to 5:00 Fere Rahul
14.09.2020 21.09.2020
3. Designing
3:00 to 5:00 3:00 to 5:00 Wakade Pavan
22.09.2020 04.10.2020
4. Implement of Coding
3:00 to 5:00 3:00 to 5:00 Maske
5.10.2020 15.10.2020 Shubham
5. Testing of Project
3:00 to 5:00 3:00 to 5:00
18.10.2020 25.10.2020 Gaikwad
6. Deployment of Module
3:00 to 5:00 3:00 to 5:00 Shubham
1.11.2020 08.11.2020
7. Prepare Out Put
3:00 to 5:00 3:00 to 5:00
Prepare Report on 20.11.2020 30.11.2020
8.
Micro Project 3:00 to 5:00 3:00 to 5:00
Sr.
No Name of Specification Quantity Remark
Resource/Material s
1 Personal computer Processor: Ryzen 3 3200g. Ram: 8GB
DDR4 3133MHz, HDD: 512GB
1 ____
2 Internet 10mbps BSNL LAN Network __ __
3 Java Development __ JDK is
Kit, Java Virtual the basic
Machine Java compiler java
compiler
(JDK , JVM) , which is
Notepad++ with very
nppexec plugin to easy to
compile and run use.
18
8. Skill Developed / Learning outcome of this Micro-Project:
We learn that how to make the project of the menu driven programming in Java
We learn that how to edit the program and how to do the presentation for the project.
19