98468110 java programming assignment scientific calculator hirosh tharaka trazor
DESCRIPTION
kkfggggggggggggggTRANSCRIPT
ASIA PACIFIC INSTITUTE OF INFORMATION TECHNOLOGY
APIIT Diploma Part II
INDIVIDUAL ASSIGNMENT
Prepared By
Hirosh Tharaka D. M. D – CB004149
Module Code
AAPP004-3-2-JP JAVA PROGRAMMING
Cohort
DF10A1ICT
Date of Submission
20th
September 2011
Instructor
Dr. Dhananjay Kulkarni
Submitted in partial fulfilment for the degree of
Bachelor of Science (Hons) in Computing
JAVA PROGRAMMING
DF10A1ICT
i | P a g e
Acknowledgement
It is with great pleasure I acknowledge all those who helped me in making this project a
success. Especially I would like to dedicate my sincere gratitude to our JAVA lecturer
Dr. Dhananjay Kulkarni for his continuous support and guidance and valuable advices
throughout the project. And also I would like to thank my friends who support me and
encourage me throughout this project.
I would also like to thank my parents who were always with me support me to fulfill my
career objectives. Last but not the least my gratitude goes to APIIT Lanka for providing
the laboratory and library facilities.
JAVA PROGRAMMING
DF10A1ICT
ii | P a g e
Abstract
The main objective of this project is to develop a basic scientific calculator using JAVA
programming language. This Scientific Calculator is based on three operational levels.
Those are Standard Mode, Scientific Mode and Programmers Mode. Under these three
main categories all the basic functions which are related like addition, subtraction,
multiplication, division, complex mathematic functions, trigonometry conversions and
base conversions are included. Interface was designed according to a very user friendly
manner with gray-tone colors
JAVA PROGRAMMING
DF10A1ICT
iii | P a g e
Table of Contents
Acknowledgement............................................................................................................... i
Abstract ............................................................................................................................. ii
Table of Figures ................................................................................................................ iv
1. Introduction ................................................................................................................. 1
2. Flow Charts ................................................................................................................. 2
a. Standard Calculation ................................................................................................... 2
b. Scientific ..................................................................................................................... 3
c. Programmer ................................................................................................................ 4
d. Other Functions........................................................................................................... 5
3. Class Diagrams ........................................................................................................... 6
4. Source Code ................................................................................................................ 9
5. Sample Outputs ......................................................................................................... 34
a. Main Menu Selection ................................................................................................ 34
b. Standard Mode .......................................................................................................... 35
i. Addition, Subtraction, Multiplication, Division, Percentage.................................... 35
c. Scientific Mode ......................................................................................................... 36
i. Sin, Cos, Tan ............................................................................................................. 36
ii. Asin, Acos, Atan ....................................................................................................... 37
iii. Square, Square root, Cube, Cube Root, Root, Power ........................................... 38
d. Programmer Mode .................................................................................................... 39
e. Other Options ............................................................................................................ 40
i. History ...................................................................................................................... 40
ii. Error .......................................................................................................................... 41
6. Test Plans .................................................................................................................. 44
7. Assumptions.............................................................................................................. 49
8. Limitations ................................................................................................................ 49
9. Bibliography ................................................................................................................. 49
JAVA PROGRAMMING
DF10A1ICT
iv | P a g e
Table of Figures
Figure 1 : Menu Radio Selection ..................................................................................... 34
Figure 2 Standard Mode Calculation ............................................................................... 35
Figure 3. Scientific Mode : Sin Calculation ..................................................................... 36
Figure 4 Scientific Mode : ACOS Calculation ................................................................ 37
Figure 5 . Scientific Mode : Power Calculation ............................................................... 38
Figure 6 : Programmer Mode : Binary to Hexa-Decimal ................................................ 39
Figure 7. History .............................................................................................................. 40
Figure 8 . Error : Cos Range ............................................................................................ 41
Figure 9 Error : Division by Zero .................................................................................... 42
Figure 10. Error: Logarithm Error .................................................................................. 43
JAVA PROGRAMMING
DF10A1ICT
1 | P a g e
1. Introduction
The entire application which is a Scientific Calculator is developed, designed and coded
using Net beans 7.0.1. Most of the mathematical functions have been done using the
functions in math class in java. This calculator is based on three categories.
One is the „standard mode‟ which only has allows the user to deal with the ordinary day
to day calculations with simple addition, subtraction, multiplication, divisions and etc
Second is the „scientific mode‟ which allows the user to deal with most the scientific
calculations like trigonometry calculations and advanced mathematical calculations.
Third is the „Programmer mode‟ which allows the user to deal with few of the
programmer‟s functions like conversions among bases of two, eight, ten and sixteen.
JAVA PROGRAMMING
DF10A1ICT
2 | P a g e
2. Flow Charts
a. Standard Calculation
Start
IF STANDARD MODE
ENTER OPERAND_ONE
IF SYMBOL = -
IF SYMBOL = *
IF SYMBOL = /
DISPLAY ANSWER
IF SYMBOL = %
ENTER OPERAND_TWO
IF SYMBOL = +
STOP
JAVA PROGRAMMING
DF10A1ICT
3 | P a g e
b. Scientific
Start
IF SCIENTIFIC MODE
ENTER OPERAND_ONE
IF Function = ASIN / ACOS /
ATAN-
IF Function = POW / ROOT
IF SYMBOL =SQR, SQRT, CUBE,
CUBERT, LOG, LOG10, EXP
DISPLAY ANSWER
ENTER OPERAND_TWO
IF Function = SIN / COS / TAN
STOP
JAVA PROGRAMMING
DF10A1ICT
4 | P a g e
c. Programmer
Start
IF Programmer MODE
ENTER OPERAND_ONE
STOP
CHECK CURRENT BASE
IF BASE = BIN
IF BASE = DEC
IF BASE = OCT
IF BASE = HEX
DISPLAY ANSWER
CONVERST TO BINARY
CONVERST TO DECIMAL
CONVERST TO OCTAL
CONVERST TO HEX
TRUE
TRUE
TRUE
TRUE
w
JAVA PROGRAMMING
DF10A1ICT
5 | P a g e
d. Other Functions
Start
IF HELP
STOP
IF HISTORY LOG
IF MS
IF MC
IF MR
IF M+
IF M-
DISPAY OUTPUT
DISPAY OUTPUT
IF C
IF C
DISPAY OUTPUT
DISPAY OUTPUT
ADD THE CURRENT VALUE TO THE
VALUE IN MEMORY
SUBTRACT CURRENT VALUE FROM THE
VALUE IN MEMORY
CLEAR THE LAST ENTERED VALUE
CLEAR THE ALL MEMORY
CLEAR MEMORY
JAVA PROGRAMMING
DF10A1ICT
6 | P a g e
3. Class Diagrams
MAIN CALCULATOR
inputvar : int
i_operat : int
d_opr1 : double
d_opr2 : double
b_LastIsOperator: boolean
mode : int
base :int
memory : double
message : String
dotFlag : int
Normal : int
Scientific : int
Programmer : int
BUTTONS
TEXT
FIELD
ACTION
PERFORM
ED
PANELS
JAVA PROGRAMMING
DF10A1ICT
7 | P a g e
Binary :int
Octal :int
Decimal :int
Hexa :int
OPERATOR_NON :int
OPERATOR_ADD :int
OPERATOR_SUB :int
OPERATOR_MUL :int
OPERATOR_DIV :int
OPERATOR_POW :int
OPERATOR_ROOT :int
OPERATOR_INV :int
OPERATOR_PERC :int
OPERATOR_SQR :int
OPERATOR_CUBE :int
OPERATOR_SQRRT :int
OPERATOR_CUBERT :int
OPERATOR_ONEOVERX :int
OPERATOR_SIN : int
OPERATOR_COS : int
OPERATOR_TAN : int
JAVA PROGRAMMING
DF10A1ICT
8 | P a g e
OPERATOR_ASIN : int
OPERATOR_ACOS : int
OPERATOR_ATAN : int
OPERATOR_TENTOTHEPOWER : int
OPERATOR_LOG : int
OPERATOR_LOG10 : int
OPERATOR_EXPO : int
old_base : int
tempvar : String
temp : int
lngth : int
sinv : double
cosv : double
tanv : double
asin : double
acos: double
atan : double
JAVA PROGRAMMING
DF10A1ICT
9 | P a g e
4. Source Code
public class TEMPCALCView extends FrameView {
int inputvar , i_operat;
String temp;
double d_opr1, d_opr2;
//boolean b_clrtxt;
boolean b_LastIsOperator;
int mode = 0; //default normal mode
int base = 10; //default decimal mode
double memory;
String message = "History : ";
int dotFlag = 0;
//int linenum;
private static int Normal = 0;
private static int Scientific = 1;
private static int Programmer = 2;
private static int Binary = 2;
private static int Octal = 8;
private static int Decimal = 10;
private static int Hexa = 16;
private static int OPERATOR_NON = 0;
private static int OPERATOR_ADD = 1;
private static int OPERATOR_SUB = 2;
private static int OPERATOR_MUL = 3;
private static int OPERATOR_DIV = 4;
private static int OPERATOR_POW = 5; //power
private static int OPERATOR_ROOT = 6; //root
private static int OPERATOR_INV = 7 ; //(+-)
private static int OPERATOR_PERC = 8; //(percentage)
private static int OPERATOR_SQR = 9; //square
private static int OPERATOR_CUBE = 10; // cube
private static int OPERATOR_SQRRT = 11; //squareroot
private static int OPERATOR_CUBERT = 12;
private static int OPERATOR_ONEOVERX = 13; //oneoverX
private static int OPERATOR_SIN = 14;
private static int OPERATOR_COS = 15;
JAVA PROGRAMMING
DF10A1ICT
10 | P a g e
private static int OPERATOR_TAN = 16;
private static int OPERATOR_ASIN = 17;
private static int OPERATOR_ACOS = 18;
private static int OPERATOR_ATAN = 19;
private static int OPERATOR_TENTOTHEPOWER = 20;
private static int OPERATOR_LOG = 21;
private static int OPERATOR_LOG10 = 22;
private static int OPERATOR_EXPO = 23;
private void jBtnClearActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jTxtEq.setText("0");
d_opr1 = 0;
d_opr2 = 0;
i_operat = OPERATOR_NON;
dotFlag = 0;
}
private void jBtnEightActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(8);
}
private void jBtnMinusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_SUB;
dotFlag = 0;
}
private void jBtnOneActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(1);
}
JAVA PROGRAMMING
DF10A1ICT
11 | P a g e
private void jBtnNineActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(9);
}
private void jBtnSixActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(6);
}
private void jBtnSevenActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(7);
}
private void jBtnThreeActionPerformed(java.awt.event.ActionEvent evt) {
setValue(3);
// TODO add your handling code here:
}
private void jBtnFourActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(4);
}
private void jBtnPlusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_ADD;
dotFlag = 0;
}
private void jBtnEqualActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_NON;
dotFlag = 0;
}
private void jBtnTwoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(2);
}
JAVA PROGRAMMING
DF10A1ICT
12 | P a g e
private void jBtnFiveActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(5);
}
private void jBtnMultiActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_MUL;
dotFlag = 0;
}
private void jBtnDivideActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_DIV;
dotFlag = 0;
}
private void jBtnZeroActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setValue(0);
}
private void jBtnPlusMinusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_INV); // <==evaluateTwoOperators
//i_operat = OPERATOR_INV;
// double tmp = Double.parseDouble(jTxtEq.getText());
// jTxtEq.setText(Double.toString(tmp*-1));
}
private void jBtnOneOverXActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//i_operat = OPERATOR_ONEOVERX;
OneOperand(OPERATOR_ONEOVERX);
}
private void jBtnSquareActionPerformed(java.awt.event.ActionEvent evt) {
JAVA PROGRAMMING
DF10A1ICT
13 | P a g e
// TODO add your handling code here:
// i_operat = OPERATOR_SQR;
OneOperand(OPERATOR_SQR);
}
private void jBtnCubeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//i_operat = OPERATOR_CUBE;
OneOperand(OPERATOR_CUBE);
}
private void jBtnPowActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_POW;
}
private void jBtnSquareRootActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//i_operat = OPERATOR_SQRRT;
OneOperand(OPERATOR_SQRRT);
}
private void jBtnCubeRootActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//i_operat = OPERATOR_CUBERT;
OneOperand(OPERATOR_CUBERT);
}
private void jBtnRootActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_ROOT;
}
private void jBtnSinActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JAVA PROGRAMMING
DF10A1ICT
14 | P a g e
OneOperand(OPERATOR_SIN);
}
private void jBtnCosActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_COS);
}
private void jBtnTanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_TAN);
}
private void jBtnASinActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_ASIN);
}
private void jBtnACosActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_ACOS);
}
private void jBtnATanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_ATAN);
}
private void jBtnTenToThePowerActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_TENTOTHEPOWER);
}
private void jBtnDotActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if ( b_LastIsOperator ) // last is operator
jTxtEq.setText("");
if (dotFlag == 0)
JAVA PROGRAMMING
DF10A1ICT
15 | P a g e
{ temp = jTxtEq.getText();
if ("0".equals(temp))
{
jTxtEq.setText("0.");
//jTxtEq.setText(Integer.toString(val));
}
else
{
//inputvar = val;
jTxtEq.setText( jTxtEq.getText() + ".");
}
b_LastIsOperator = false;
dotFlag = 1;
}
}
private void jBtnLogActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_LOG);
}
private void jBtnLog10ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_LOG10);
}
private void jRBM_NormalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mode = Normal;
jLbl_Mode.setText("Standard Mode");
//jPanel_Programmer.enable(false);
//jPanel_Trigonometry.enable(false);
jBtnSin.setEnabled(false);
jBtnCos.setEnabled(false);
jBtnTan.setEnabled(false);
jBtnASin.setEnabled(false);
jBtnACos.setEnabled(false);
jBtnATan.setEnabled(false);
jBtnLog.setEnabled(false);
jBtnLog10.setEnabled(false);
jBtnSquare.setEnabled(false);
jBtnCube.setEnabled(false);
JAVA PROGRAMMING
DF10A1ICT
16 | P a g e
jBtnPow.setEnabled(false);
jBtnSquareRoot.setEnabled(false);
jBtnCubeRoot.setEnabled(false);
jBtnRoot.setEnabled(false);
jBtnOneOverX.setEnabled(false);
jBtnTenToThePower.setEnabled(false);
jBtnExpo.setEnabled(false);
jRB_BIN.setEnabled(false);
jRB_OCT.setEnabled(false);
jRB_DEC.setEnabled(false);
jRB_HEX.setEnabled(false);
jBtnA.setEnabled(false);
jBtnB.setEnabled(false);
jBtnC.setEnabled(false);
jBtnD.setEnabled(false);
jBtnE.setEnabled(false);
jBtnF.setEnabled(false);
jBtnDot.setEnabled(true);
jBtnPerc.setEnabled(true);
jBtnZero.setEnabled(true);
jBtnOne.setEnabled(true);
jBtnTwo.setEnabled(true);
jBtnThree.setEnabled(true);
jBtnFour.setEnabled(true);
jBtnFive.setEnabled(true);
jBtnSix.setEnabled(true);
jBtnSeven.setEnabled(true);
jBtnEight.setEnabled(true);
jBtnNine.setEnabled(true);
jBtnMemSave.setEnabled(true);
jBtnMemRecall.setEnabled(true);
jBtnMemClear.setEnabled(true);
jBtnMPus.setEnabled(true);
jBtnMMinus.setEnabled(true);
}
JAVA PROGRAMMING
DF10A1ICT
17 | P a g e
private void jRBM_ScientificActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mode = Scientific;
jLbl_Mode.setText("Scientific Mode");
//jPanel_Programmer.enable(false);
//jPanel_Trigonometry.enable(true);
jBtnSin.setEnabled(true);
jBtnCos.setEnabled(true);
jBtnTan.setEnabled(true);
jBtnASin.setEnabled(true);
jBtnACos.setEnabled(true);
jBtnATan.setEnabled(true);
jBtnLog.setEnabled(true);
jBtnLog10.setEnabled(true);
jBtnSquare.setEnabled(true);
jBtnCube.setEnabled(true);
jBtnPow.setEnabled(true);
jBtnSquareRoot.setEnabled(true);
jBtnCubeRoot.setEnabled(true);
jBtnRoot.setEnabled(true);
jBtnOneOverX.setEnabled(true);
jBtnTenToThePower.setEnabled(true);
jBtnExpo.setEnabled(true);
jRB_BIN.setEnabled(false);
jRB_OCT.setEnabled(false);
jRB_DEC.setEnabled(false);
jRB_HEX.setEnabled(false);
jBtnA.setEnabled(false);
jBtnB.setEnabled(false);
jBtnC.setEnabled(false);
jBtnD.setEnabled(false);
jBtnE.setEnabled(false);
jBtnF.setEnabled(false);
jBtnZero.setEnabled(true);
jBtnOne.setEnabled(true);
jBtnTwo.setEnabled(true);
jBtnThree.setEnabled(true);
jBtnFour.setEnabled(true);
jBtnFive.setEnabled(true);
jBtnSix.setEnabled(true);
JAVA PROGRAMMING
DF10A1ICT
18 | P a g e
jBtnSeven.setEnabled(true);
jBtnEight.setEnabled(true);
jBtnNine.setEnabled(true);
jBtnDot.setEnabled(true);
jBtnPerc.setEnabled(false);
jBtnMemSave.setEnabled(true);
jBtnMemRecall.setEnabled(true);
jBtnMemClear.setEnabled(true);
jBtnMPus.setEnabled(true);
jBtnMMinus.setEnabled(true);
}
private void jRBM_ProgrammerActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mode = Programmer;
base = Decimal;
jLbl_Mode.setText("Programmer Mode");
//jPanel_Programmer.enable(true);
//jPanel_Trigonometry.enable(false);
jBtnSin.setEnabled(false);
jBtnCos.setEnabled(false);
jBtnTan.setEnabled(false);
jBtnASin.setEnabled(false);
jBtnACos.setEnabled(false);
jBtnATan.setEnabled(false);
jBtnLog.setEnabled(false);
jBtnLog10.setEnabled(false);
jBtnSquare.setEnabled(false);
jBtnCube.setEnabled(false);
jBtnPow.setEnabled(false);
jBtnSquareRoot.setEnabled(false);
jBtnCubeRoot.setEnabled(false);
jBtnRoot.setEnabled(false);
jBtnOneOverX.setEnabled(false);
jBtnTenToThePower.setEnabled(false);
jBtnExpo.setEnabled(false);
jBtnDot.setEnabled(false);
jBtnPerc.setEnabled(false);
jRB_BIN.setEnabled(true);
JAVA PROGRAMMING
DF10A1ICT
19 | P a g e
jRB_OCT.setEnabled(true);
jRB_DEC.setEnabled(true);
jRB_HEX.setEnabled(true);
jBtnA.setEnabled(false);
jBtnB.setEnabled(false);
jBtnC.setEnabled(false);
jBtnD.setEnabled(false);
jBtnE.setEnabled(false);
jBtnF.setEnabled(false);
jBtnMemSave.setEnabled(false);
jBtnMemRecall.setEnabled(false);
jBtnMemClear.setEnabled(false);
jBtnMPus.setEnabled(false);
jBtnMMinus.setEnabled(false);
}
private void jRB_BINActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int old_base = base;
String tempvar = jTxtEq.getText();
int temp = Integer.parseInt((jTxtEq.getText()), base);
jTxtEq.setText(Integer.toBinaryString(temp));
base = Binary;
message = message + "\n " + tempvar + " base " + old_base + " = " +
Integer.toBinaryString(temp) + " base " + base ;
//int temp = Integer.parseInt((jTxtEq.getText()), base);
// jTxtEq.setText(Integer.toBinaryString(temp));
//base = Binary;
jBtnA.setEnabled(false);
jBtnB.setEnabled(false);
jBtnC.setEnabled(false);
jBtnD.setEnabled(false);
jBtnE.setEnabled(false);
jBtnF.setEnabled(false);
JAVA PROGRAMMING
DF10A1ICT
20 | P a g e
jBtnZero.setEnabled(true);
jBtnOne.setEnabled(true);
jBtnTwo.setEnabled(false);
jBtnThree.setEnabled(false);
jBtnFour.setEnabled(false);
jBtnFive.setEnabled(false);
jBtnSix.setEnabled(false);
jBtnSeven.setEnabled(false);
jBtnEight.setEnabled(false);
jBtnNine.setEnabled(false);
}
private void jRB_OCTActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int old_base = base;
String tempvar = jTxtEq.getText();
int temp = Integer.parseInt((jTxtEq.getText()), base);
jTxtEq.setText(Integer.toOctalString(temp));
base = Octal;
message = message + "\n " + tempvar + " base " + old_base + " = " +
Integer.toOctalString(temp) + " base " + base ;
jBtnA.setEnabled(false);
jBtnB.setEnabled(false);
jBtnC.setEnabled(false);
jBtnD.setEnabled(false);
jBtnE.setEnabled(false);
jBtnF.setEnabled(false);
jBtnZero.setEnabled(true);
jBtnOne.setEnabled(true);
jBtnTwo.setEnabled(true);
jBtnThree.setEnabled(true);
jBtnFour.setEnabled(true);
jBtnFive.setEnabled(true);
jBtnSix.setEnabled(true);
jBtnSeven.setEnabled(true);
jBtnEight.setEnabled(false);
jBtnNine.setEnabled(false);
}
JAVA PROGRAMMING
DF10A1ICT
21 | P a g e
private void jRB_DECActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int old_base = base;
String tempvar = jTxtEq.getText();
int temp = Integer.parseInt((jTxtEq.getText()), base);
jTxtEq.setText(Integer.toString(temp));
base = Decimal;
message = message + "\n " + tempvar + " base " + old_base + " = " +
Integer.toString(temp) + " base " + base ;
jBtnA.setEnabled(false);
jBtnB.setEnabled(false);
jBtnC.setEnabled(false);
jBtnD.setEnabled(false);
jBtnE.setEnabled(false);
jBtnF.setEnabled(false);
jBtnZero.setEnabled(true);
jBtnOne.setEnabled(true);
jBtnTwo.setEnabled(true);
jBtnThree.setEnabled(true);
jBtnFour.setEnabled(true);
jBtnFive.setEnabled(true);
jBtnSix.setEnabled(true);
jBtnSeven.setEnabled(true);
jBtnEight.setEnabled(true);
jBtnNine.setEnabled(true);
}
private void jRB_HEXActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int old_base = base;
String tempvar = jTxtEq.getText();
int temp = Integer.parseInt((jTxtEq.getText()), base);
jTxtEq.setText(Integer.toHexString(temp));
base = Hexa;
JAVA PROGRAMMING
DF10A1ICT
22 | P a g e
message = message + "\n " + tempvar + " base " + old_base + " = " +
Integer.toHexString(temp) + " base " + base ;
jBtnA.setEnabled(true);
jBtnB.setEnabled(true);
jBtnC.setEnabled(true);
jBtnD.setEnabled(true);
jBtnE.setEnabled(true);
jBtnF.setEnabled(true);
jBtnZero.setEnabled(true);
jBtnOne.setEnabled(true);
jBtnTwo.setEnabled(true);
jBtnThree.setEnabled(true);
jBtnFour.setEnabled(true);
jBtnFive.setEnabled(true);
jBtnSix.setEnabled(true);
jBtnSeven.setEnabled(true);
jBtnEight.setEnabled(true);
jBtnNine.setEnabled(true);
}
private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jBtnPercActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Operands();
i_operat = OPERATOR_PERC;
}
private void jBtnExpoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
OneOperand(OPERATOR_EXPO);
}
private void jBtnMemSaveActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
memory = Double.parseDouble(jTxtEq.getText());
jLblMemory.setText(Double.toString(memory));
}
private void jBtnMemClearActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
memory = 0;
JAVA PROGRAMMING
DF10A1ICT
23 | P a g e
jLblMemory.setText("Empty");
}
private void jBtnMPusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//M + y
b_LastIsOperator = true;
d_opr2 = Double.parseDouble(jTxtEq.getText());
d_opr2 = memory + d_opr2;
jTxtEq.setText(Double.toString(d_opr2));
i_operat = OPERATOR_ADD;
}
private void jBtnMMinusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
// M - y
b_LastIsOperator = true;
d_opr2 = Double.parseDouble(jTxtEq.getText());
d_opr2 = memory - d_opr2;
jTxtEq.setText(Double.toString(d_opr2));
i_operat = OPERATOR_SUB;
}
private void jBtnHLogActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//linenum++;
//message = message + "\nLine" + Integer.toString(linenum) + " : " + "message" ;
JOptionPane.showMessageDialog(null, message);
}
private void jBtnAllClearActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jTxtEq.setText("0");
d_opr1 = 0;
d_opr2 = 0;
i_operat = OPERATOR_NON;
message = "History : ";
memory = 0;
jLblMemory.setText("Empty");
dotFlag = 0;
}
JAVA PROGRAMMING
DF10A1ICT
24 | P a g e
private void jBtnAActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if ( b_LastIsOperator ) // last is operator
jTxtEq.setText("");
temp = jTxtEq.getText();
if ("0".equals(temp))
{
jTxtEq.setText("A");
//jTxtEq.setText(Integer.toString(val));
}
else
{
//inputvar = val;
jTxtEq.setText( jTxtEq.getText() + "A");
}
b_LastIsOperator = false;
}
private void jBtnBActionPerformed(java.awt.event.ActionEvent evt) {
if ( b_LastIsOperator ) // last is operator
jTxtEq.setText("");
temp = jTxtEq.getText();
if ("0".equals(temp))
{
jTxtEq.setText("B");
//jTxtEq.setText(Integer.toString(val));
}
else
{
//inputvar = val;
jTxtEq.setText( jTxtEq.getText() + "B");
}
b_LastIsOperator = false;// TODO add your handling code here:
}
private void jBtnCActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if ( b_LastIsOperator ) // last is operator
jTxtEq.setText("");
temp = jTxtEq.getText();
if ("0".equals(temp))
{
JAVA PROGRAMMING
DF10A1ICT
25 | P a g e
jTxtEq.setText("C");
//jTxtEq.setText(Integer.toString(val));
}
else
{
//inputvar = val;
jTxtEq.setText( jTxtEq.getText() + "C");
}
b_LastIsOperator = false;
}
private void jBtnDActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if ( b_LastIsOperator ) // last is operator
jTxtEq.setText("");
temp = jTxtEq.getText();
if ("0".equals(temp))
{
jTxtEq.setText("D");
//jTxtEq.setText(Integer.toString(val));
}
else
{
//inputvar = val;
jTxtEq.setText( jTxtEq.getText() + "D");
}
b_LastIsOperator = false;
}
private void jBtnEActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if ( b_LastIsOperator ) // last is operator
jTxtEq.setText("");
temp = jTxtEq.getText();
if ("0".equals(temp))
{
jTxtEq.setText("E");
//jTxtEq.setText(Integer.toString(val));
}
else
{
//inputvar = val;
jTxtEq.setText( jTxtEq.getText() + "E");
}
JAVA PROGRAMMING
DF10A1ICT
26 | P a g e
b_LastIsOperator = false;
}
private void jBtnFActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if ( b_LastIsOperator ) // last is operator
jTxtEq.setText("");
temp = jTxtEq.getText();
if ("0".equals(temp))
{
jTxtEq.setText("F");
//jTxtEq.setText(Integer.toString(val));
}
else
{
//inputvar = val;
jTxtEq.setText( jTxtEq.getText() + "F");
}
b_LastIsOperator = false;
}
private void jBtnDelActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String temp2 = jTxtEq.getText();
int lngth = temp2.length();
temp2 = temp2.substring( 0 , lngth - 1);
jTxtEq.setText(temp2);
//temp2 = txt_ans.getText();
//leng = temp2.length();
//temp2 = temp2.substring(0, leng - 1);
//txt_ans.setText(temp2);
}
private void jBtnMemRecallActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//memory = Double.parseDouble(jTxtEq.getText());
jTxtEq.setText(Double.toString(memory));
//jLblMemory.setText(Double.toString(memory));
}
JAVA PROGRAMMING
DF10A1ICT
27 | P a g e
//FUNCTIONS =========
private void OneOperand (int temp_operator)
{
b_LastIsOperator = true;
d_opr2 = Double.parseDouble(jTxtEq.getText());
d_opr2 = evaluateValue(0,d_opr2, temp_operator);
jTxtEq.setText(Double.toString(d_opr2));
}
private void Operands ()
{
b_LastIsOperator = true;
//selection
{
d_opr2 = Double.parseDouble(jTxtEq.getText());
d_opr1 = evaluateValue(d_opr1, d_opr2, i_operat);
jTxtEq.setText(Double.toString(d_opr1));
}
}
private void setValue (int val)
{
if ( b_LastIsOperator ) // LastIsOperator
jTxtEq.setText("");
temp = jTxtEq.getText();
if ("0".equals(temp))
{
jTxtEq.setText(Integer.toString(val));
}
else
{
inputvar = val;
jTxtEq.setText( jTxtEq.getText() + inputvar);
}
b_LastIsOperator = false;
}
private double evaluateValue ( double x ,double y, int operator )
{
JAVA PROGRAMMING
DF10A1ICT
28 | P a g e
DecimalFormat twoDForm = new DecimalFormat("#.####");
switch(operator)
{
case 1 :
message = message + "\n" + Double.toString(x) + " + " + Double.toString(y)
+ " = " + (x+y);
return x + y ;
case 2 :
message = message + "\n" + Double.toString(x) + " - " + Double.toString(y)
+ " = " + (x-y);
return x - y ;
case 3 :
message = message + "\n" + Double.toString(x) + " * " + Double.toString(y)
+ " = " + (x*y);
return x * y ;
case 4 :
if (y == 0)
{
JOptionPane.showMessageDialog(null, "Error : Dividign By Zero ");
return 0;
}
else
{
message = message + "\n" + Double.toString(x) + " / " +
Double.toString(y) + " = " + (x/y);
return x / y ;
}
case 5 :
message = message + "\n" + Double.toString(x) + " ^ " + Double.toString(y)
+ " = " + (Math.pow(x,y));
return (Math.pow(x,y)) ;
case 6 :
if (x < 0)
{
JOptionPane.showMessageDialog(null, "Error : No Root for Negative
values ");
return 0;
}
else
{
JAVA PROGRAMMING
DF10A1ICT
29 | P a g e
message = message + "\n" + Double.toString(y) + " √ " +
Double.toString(x) + " = " + (Math.pow(x,(1/y)));
return (Math.pow(x,(1/y)));
}
case 7 :
message = message + "\n" + Double.toString(y) + " ± " + " = " + (y*-1);
return (y*-1) ;
case 8 :
if (y == 0)
{
JOptionPane.showMessageDialog(null, "Error : Dividign By Zero ");
return 0;
}
else
{
message = message + "\n" + Double.toString(x) + " % " +
Double.toString(y) + " = " + ((x/y)*100);
return (x/y)*100; // percentage
}
case 9 :
message = message + "\n" + Double.toString(y) + " ^ " + Double.toString(2)
+ " = " + (Math.pow(y,2));
return (Math.pow(y,2));
case 10:
message = message + "\n" + Double.toString(y) + " ^ " + Double.toString(3)
+ " = " + (Math.pow(y,3));
return (Math.pow(y,3));
case 11:
if (y < 0)
{
JOptionPane.showMessageDialog(null, "Error : No Squareroot for
Negative values ");
return 0;
}
else
{
message = message + "\n" + Double.toString(2) + " √ " +
Double.toString(y) + " = " + (Math.sqrt(y));
return (Math.sqrt(y));
}
case 12:
JAVA PROGRAMMING
DF10A1ICT
30 | P a g e
message = message + "\n" + Double.toString(3) + " √ " + Double.toString(y)
+ " = " + (Math.cbrt(y));
return (Math.cbrt(y));
case 13:
if (y == 0)
{
JOptionPane.showMessageDialog(null, "Error : Dividing By Zero");
return 0;
}
else
{
message = message + "\n" + Double.toString(1) + " / " +
Double.toString(y) + " = " + (1/y);
return (1/y) ;
}
case 14:
double sinv = Math.sin(Math.toRadians(y));
//DecimalFormat twoDForm = new DecimalFormat("#.####");
sinv = Double.valueOf(twoDForm.format(sinv));
message = message + "\n Sin " + Double.toString(y) + " = " + sinv;
return sinv;
//return (Math.sin(Math.toRadians(y)));
case 15:
double cosv = Math.cos(Math.toRadians(y));
//DecimalFormat twoDForm = new DecimalFormat("#.####");
cosv = Double.valueOf(twoDForm.format(cosv));
message = message + "\n Cos " + Double.toString(y) + " = " + cosv;
return cosv;
//return (Math.cos(Math.toRadians(y)));
case 16:
//if (y == 90)
//{
//invalid input
// jTxtEq.setText("Invalid Input");
//return 0;
// }
//else
{
double tanv = Math.tan(Math.toRadians(y));
//DecimalFormat twoDForm = new DecimalFormat("#.####");
tanv = Double.valueOf(twoDForm.format(tanv));
JAVA PROGRAMMING
DF10A1ICT
31 | P a g e
message = message + "\n Tan " + Double.toString(y) + " = " + tanv;
return tanv;
}
// (Math.tan(Math.toRadians(y)));
case 17:
if ( y < -1 || y > 1)
{
JOptionPane.showMessageDialog(null, "Error : Sin Value Is Out of
Range ( Sin : -1 ~ 1 ) ");
return 0;
}
else
{
double asin = Math.toDegrees(Math.asin(y));
asin = Double.valueOf(twoDForm.format(asin));
message = message + "\n ASin " + Double.toString(y) + " = " + asin;
return asin;
}
case 18:
if ( y < -1 || y > 1)
{
JOptionPane.showMessageDialog(null, "Error : Cos Value Is Out of
Range ( Cos : -1 ~ 1 ) ");
return 0;
}
else
{
double acos = Math.toDegrees(Math.acos(y));
acos = Double.valueOf(twoDForm.format(acos));
message = message + "\n ACos " + Double.toString(y) + " = " + acos;
return acos;
}
//message = message + "\n ACos " + Double.toString(y) + " = " +
(Math.acos(y));
//return (Math.acos(y));
case 19:
double atan = Math.toDegrees(Math.atan(y));
atan = Double.valueOf(twoDForm.format(atan));
message = message + "\n ATan " + Double.toString(y) + " = " + atan;
return atan;
//message = message + "\n ATan " + Double.toString(y) + " = " +
(Math.atan(y));
// return (Math.atan(y));
JAVA PROGRAMMING
DF10A1ICT
32 | P a g e
case 20:
message = message + "\n" + Double.toString(10) + " ^ " + Double.toString(y)
+ " = " + (Math.pow(10,y));
return (Math.pow(10, y));
case 21:
if ( y <= 0)
{
JOptionPane.showMessageDialog(null, "Error : Cannot find log of a
negative value ");
return 0;
}
else
{
message = message + "\n log " + Double.toString(y) + " = " + (Math.log(y));
return (Math.log(y));
}
case 22:
if ( y <= 0)
{
JOptionPane.showMessageDialog(null, "Error : Cannot find log of a
negative value ");
return 0;
}
else
{
message = message + "\n log10 " + Double.toString(y) + " = " +
(Math.log10(y));
return (Math.log10(y));
}
case 23:
message = message + "\n Exp " + Double.toString(y) + " = " +
(Math.exp(y));
return (Math.exp(y));
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
JAVA PROGRAMMING
DF10A1ICT
34 | P a g e
5. Sample Outputs
a. Main Menu Selection
Figure 1 : Menu Radio Selection
The above figure shows the main menu with three radio buttons where the user can
select which mode the user going to use. And the short cut keys are assigned for it.
Normal : Ctrl + N
Scientific : Ctrl + S
Programmer : Ctrl + P
JAVA PROGRAMMING
DF10A1ICT
35 | P a g e
b. Standard Mode
i. Addition, Subtraction, Multiplication, Division,
Percentage
Figure 2 Standard Mode Calculation
The above figure is the result of addition of two numbers. Once the user click the
buttons in followings sequence fended with an equal sign, the result will be displayed in
the screen.
(Operand one )(Operator) (Operand two) (“=”)
JAVA PROGRAMMING
DF10A1ICT
36 | P a g e
The above answer in the calculator is calculated for 9 + 6.
c. Scientific Mode
i. Sin, Cos, Tan
Figure 3. Scientific Mode : Sin Calculation
The above figure is the for the Sin value of Degree 30. Once the user click the buttons in
followings sequence fended with an equal sign, the result will be displayed in the screen.
JAVA PROGRAMMING
DF10A1ICT
37 | P a g e
(Angel in degrees)(Trigonometry Operation) (“=”)
The above answer in the calculator is calculated for 30 Sin = 0.5
ii. Asin, Acos, Atan
Figure 4 Scientific Mode : ACOS Calculation
JAVA PROGRAMMING
DF10A1ICT
38 | P a g e
The above figure is for the Cos inverse of 0.5. Once the user click the buttons in
followings sequence fended with an equal sign, the result will be displayed in the screen.
(Trigonometry Value)(Anti Trigonometry Operation) (“=”)
The above answer in the calculator is calculated for 0.5 Acos = 60
iii. Square, Square root, Cube, Cube Root, Root, Power
Figure 5 . Scientific Mode : Power Calculation
JAVA PROGRAMMING
DF10A1ICT
39 | P a g e
The above figure is for the 2 to the power of 6. Once the user click the buttons in
followings sequence fended with an equal sign, the result will be displayed in the screen.
(Operand One)(Advanced Mathematical Function) (Operand Two)( (“=”)
The above answer in the calculator is calculated for 2^6 = 64.
d. Programmer Mode
Figure 6 : Programmer Mode : Binary to Hexa-Decimal
The above calculation is done for the conversion from base if two ( binary ) to base of
sixteen (16). The above calculation is 111102 >1e16
JAVA PROGRAMMING
DF10A1ICT
40 | P a g e
e. Other Options
i. History
Figure 7. History
The above figure shows the preview of how the history will be viewed as the user
pressed the “History log”
JAVA PROGRAMMING
DF10A1ICT
41 | P a g e
ii. Error
Figure 8 . Error : Cos Range
The above error shows when the user tries to get the Cos invers value of any value
which is larger than 1 on less than -1. In the same way it works for sin inverse.
JAVA PROGRAMMING
DF10A1ICT
42 | P a g e
Figure 9 Error : Division by Zero
Once the user tries to divide any value from zero, it throws the dvision by zero like
shown in the above figure.
JAVA PROGRAMMING
DF10A1ICT
43 | P a g e
Figure 10. Error: Logarithm Error
The above error throws from the calculator when the user tries to find the log value of a
negative value.
JAVA PROGRAMMING
DF10A1ICT
44 | P a g e
6. Test Plans
Test
No.
Function Pre-
Conditions
Test Steps Input Output
1. Addition At least one
numeric
character must
be entered
before clicking
„+‟
- Enter first
operand
- Click „+‟
- Enter the
second
operand
- Click „=‟
56+4 6.0
2. Subtraction At least one
numeric
character must
be entered
before clicking
„-‟
- Enter first
operand
- Click „-‟
- Enter the
second
operand
- Click „=‟
9-3 6.0
3. Multiplication At least one
numeric
character must
be entered
before clicking
„*‟
- Enter first
operand
- Click „*‟
- Enter the
second
operand
- Click „=‟
8*3 24.0
4. Division At least one
numeric
character must
be entered
before clicking
„*‟
- Enter first
operand
- Click „/‟
- Enter the
second
operand
- Click „=‟‟
20/5 4.0
5. Power At least one
numeric
character must
be entered
before clicking
„^‟
- Enter first
operand
- Click „^‟
- Enter the
second
operand
- Click „=‟‟
3 „x^y‟ 3 27.0
6. Root At least one
numeric
character must
be entered
- Enter first
operand
- Click „√‟
- Enter the
2 ‟y√x‟ 9 3.0
JAVA PROGRAMMING
DF10A1ICT
45 | P a g e
before clicking
„√‟
second
operand
Click „=‟‟
7. Exponential At least one
numeric
character must
be entered
before clicking
„exp‟
- Enter first
operand
- Click „exp‟
- Click „=‟‟
2 exp 7.389
8. Percentage At least one
number should
be entered
before clicking
„%‟
- Enter first
operand
- Click „%‟
- Enter the
second
operand
- Click „=‟‟
2 % 5
10
9. Decimal At least one
number should
be entered
before clicking
„DEC‟
- Enter a
binary, octal
or
hexadecimal
value
- Click on
„DEC‟ Radio
Button
1001 9
10. Hexadecimal At least one
number should
be entered
before clicking
„HEX‟
- Enter a
binary, octal
or decimal
value
- Click on
„HEX‟ Radio
Button
15 F
11. Octal At least one
number should
be entered
before clicking
„OCT‟
- Enter a
binary,
hexadecimal
or decimal
value
- Click on
„OCT‟ Radio
Button
1111 17
12. Binary At least one
number should
be entered
before clicking
„BIN‟
- Enter a
binary, octal
or decimal
value
- Click on
„BIN‟ Radio
15 1111
JAVA PROGRAMMING
DF10A1ICT
46 | P a g e
Button
13. All Clear (C) - Click on „C‟ to
clear the display
and all data
stored in the
memory
1256 C -
14. Clear (CE) At least one
number should
be entered
before clicking
„CE‟
Click on „CE‟ to
the value in
display
1234 CE 0
15. History Log - Click on
„History‟ to view
calculation log
- 5.0+3.0=9
Cos 60.0=0.5
16. Unary ± At least one
number should
be entered
before clicking
„±‟
- Enter a value
- Click on „±‟
95 ± -95.0
17. Sin At least one
number should
be entered in
degrees before
clicking „Sin‟
- Enter a value
- Click on
„Sin‟
30 sin 0.5
18. Cosin At least one
number should
be entered in
degrees before
clicking „Cos‟
- Enter a value
- Click on
„Cos‟
60 cos 0.5
19. Tan At least one
number should
be entered in
degrees before
clicking „Tan‟
- Enter a value
- Click on
„Tan‟
45 tan 1
20. Sine Inverse At least one
number should
be entered in
radian before
clicking „ASin‟
- Enter a value
- Click on
„Asin‟
0.5 Asin 30.0
21. Cosine
Inverse
At least one
number should
be entered in
radian before
clicking
„ACos‟
- Enter a value
- Click on
„Acos‟
0.5 Acos 60.0
JAVA PROGRAMMING
DF10A1ICT
47 | P a g e
22. Tangent
Inverse
At least one
number should
be entered in
radian before
clicking
„ATan‟
- Enter a value
- Click on
„Atan‟
1 Atan 45
23. Square At least one
number must
be entered
before clicking
„x^2‟
- Enter a value
- Click on
„x^2‟
5 „x^2‟ 25.0
24. Cube At least one
number must
be entered
before clicking
„x^3‟
- Enter a value
- Click on
„x^3‟
3 „x^3‟ 27.0
25. Square Root At least one
number must
be entered
before clicking
„2√x‟
- Enter a value
- Click on ‘2√x’
16 „2√x‟ 4.0
26. Cube Root At least one
number must
be entered
before clicking
„3√x‟
- Enter a value
- Click on
„3√x‟
8 „3√x‟ 2.0
27. 10^x At least one
number must
be entered
before clicking
„10^x‟
- Enter a value
- Click on
„10^x‟
10 ^ 4 10000
28. 1/x At least one
number must
be entered
before clicking
„1/x‟
- Enter a value
- Click on
„1/x‟
1 „1/x‟ 5 0.25
29 log At least one
number must
be entered
before clicking
„log‟
- Enter a value
- Click on
„log‟
50 log 1.6989
30 log10 At least one
number must
be entered
before clicking
- Enter a value
- Click on
„log10‟
2 log10 0.3010
JAVA PROGRAMMING
DF10A1ICT
48 | P a g e
„log10‟
31. Memory Save At least one
number must
be entered or
calculate to
store before
clicking “MS”
Click on „MS‟ 5.0 -
32. Memory
Recall
- Click on „MR‟ - 4.0
33. Memory
Clear
- Click on „MC‟ - -
34 Memory Add At least one
number must
be entered or
calculate to
store before
clicking “M+”
- Enter a value
or calculation
- Click on
„M+‟
If M = 65.0
5 M+
70
35 Memory
Subtract
At least one
number must
be entered or
calculate to
store before
clicking “M-”
- Enter a value
or calculation
- Click on „M-
‟
If M = 65.0
5 M-
-60
JAVA PROGRAMMING
DF10A1ICT
49 | P a g e
7. Assumptions
Assume that all the inputs are done by mouse
The users won’t use the text field(display) to direct inputs
8. Limitations
All the inputs are allowed to input in Degrees for sin, cos, tan.
All the Asin, Acos and Atan give the output from degrees.
Not compatible with brackets.
Calculations in Binary, Octal, Decimal and Hex-Decimal are not allowed, only the
conversions are allowed among those bases.
9. Bibliography
Anon., n.d. Java 2 Platform Standard Ed. 5.0. [Online] Available at:
http://download.oracle.com/javase/1,5,0/docs/api/java/lang/Math.html [Accessed 15
September 2011].