B.tech It Batchno 55
B.tech It Batchno 55
B.tech It Batchno 55
at
Sathyabama Institute of Science and Technology
(DEEMED TO BE UNIVERSITY)
INFORMATION TECHNOLOGY
By
BHARATHI R
(REG NO: 37120015)
BONAFIDE CERTIFICATE
Internal Guide
Dr. S.REVATHY. M.E., Ph.D.,
DECLARATION
2
I, BHARATHI.R (Reg.No:37120015) hereby declare that the
Professional Training Report on “SCIENTIFIC CALCULATOR APP”
done by me under The Guidance of guide Dr. S. REVATHY. M.E.,
Ph.D., Dept of IT at Sathyabama Institute of Science and Technology is
submitted in partial fulfilment of the requirements for the award of
Bachelor of Technology degree in Information Technology.
DATE:
3
ACKNOWLEDGEMENT
4
TRAINING CERTIFICATE
5
ONLINE CERTIFICATION
6
ABSTRACT
This work was centred on the Design and implementation of a simple
scientific calculator for education organization. The study traced the calculator
system as a tool to completely change mathematical knowledge and sophisticated
problems solving strategies had advanced the field of simulated engines in
mathematics. This project work also focused principally on numbers and arithmetic
operation. This researcher investigated the manual system in detail with a view to
finding out the need to automate the system. Interestingly, the end result of a
simple scientific calculator system was its ability to process numbers and
operators, and provides a useful result. Therefore, this project will help immensely
in the following way. Easy calculating of tedious mathematical problems, easy to
retrieve errors and it will also be of good assistance to any researcher on these
topics.
7
TABLE OF CONTENTS
CHAPTER TITLE PAGE NO
ABSTRACT 7
LIST OF FIGURES 10
LIST OF TABLES 11
LIST OF ABBREVIATIONS 12
1 INTRODUCTION
1.1 OVERVIEW OF CALCULATOR 13
8
LIST OF FIGURES
9
LIST OF TABLES
10
LIST OF ABBREVATIONS
OS - Operating System
11
CHAPTER 1
INTRODUCTION
Basic calculators are great for solving simple equations with one or two
variables, but scientific calculators allow you to input a problem that has an
order of operations. If you enter one of these equations into a
12
regular calculator, it won't be able to correctly determine which numbers should
be addressed first.
Calculators are simply a tool students use to help solve problems. Since
they eliminate tedious computations and algebraic manipulations that
discourage many students, calculators allow more students to solve problems
and appreciate the power and value of mathematics in the world today.
13
CHAPTER 2
AIM AND SCOPE OF THE SYSTEM
⮚ First, it will have a screen to display the user inputs and by default, it will
display a „0‟.
⮚ Then there will be another screen that shows the result and the operator..
⮚ Then we will have the keys that will have numbers as well as the operators on
it.
⮚ In order to use the calculator, we need to put the input and select the operation
then the result will be generated.
2.2 ADVANTAGES
❖ Simple interface
❖ User friendly
❖ Fast results
2.3 LITERATURE REVIEW
2.3.1 OVERVIEW OF LITERATURE REVIEW
14
⮚ To help define the focus of your research topic.
⮚ To identify research already conducted in your field of interest, find
gaps in existing scholarship, and avoid repetition of previous
research.
⮚ To become familiar with significant earlier research and with current
progress and/or controversy in your field of interest.
⮚ To diagnose the strengths and weaknesses in the works pertaining
to your field of interest.
2.3.3 LITERATURE REVIEW ON SCIENTIFIC CALCULATOR
Xin (2009) points out that the use of calculators has a
technological
contribution to make to learning because it makes learning and teaching
attractive, helpful, and proficient for the future (Xin, 2009). Investigation into this
topic has helped the researcher to identify the aspects that were covered and their
findings, to link previous findings with the researcher‟s own findings, and to provide
well-informed recommendations.
Unfortunately, the researcher could not find recent research that
measures the effectiveness of calculators since most of the investigation into this
topic was carried out at the time that calculators were introduced, which was about
fifteen to twenty years ago. However, most of the recent research is qualitative,
basing arguments on what has already been found, and mostly intended to change
teachers‟ and parents‟ attitudes towards calculators. However, previous research
studies were not based on the South African context. However, this research
differs in that it investigates the effectiveness of a calculator with regard to
teaching and learning fractions at Grade 8 level (13-15 year olds) in South Africa.
Additionally, the researcher embraced the advantages and disadvantages that
previous research gathered in terms of the use of calculators in mathematics
education, its established advantages as noted by (Hembree & Dessart,1986), and
the myths (Pomeranz,1997) associated with its use, thereby considering the full
use of calculators in the classroom.
15
CHAPTER 3
EXPERIMENTAL METHODS
3.1HARDWARE REQUIREMENTS
❖ Windows 10 OS
❖ JDK 1.7
❖ Android Studio
❖ Gradle Scripts
❖ AVD and SDK tools
❖ XML
❖ Java
3.3.1 XML
<root>
<child>
<subchild>.....</subchild>
</child>
</root>
3.3.2 JAVA
17
debugging a program is easy in java. It helps to create modular programs and
reusable code.
This is generally referred as JVM. Before, we discuss about JVM lets see
the phases of program execution. Phases are as follows: we write the
program, then we compile the program and at last we run the program.
1) Writing of the program is of course done by java programmer like you and
me.
2) Compilation of program is done by javac compiler, javac is the primary java
compiler included in java development kit (JDK). It takes java program as input
and generates java bytecode as output.
3) In third phase, JVM executes the bytecode generated by compiler. This is
called program run phase.
18
Figure 3.2 Architecture of JVM
3.4 METHODOLOGY:
The methodology of the project starts with creating the user interface
layout .This layouts are created in the xml files and the initialization of all the
methods, functions are done in the java file.
❖ Arithmetic operations
❖ Trigonometric operations
❖ Other operations
19
The arithmetic operations available in the app are: addition (+),
subtraction(-), multiplication(*) and division(/).
The trigonometric operations available in the app are: sin, cos and tan.
The other operations available in the app are: log , ln , square root,
power , factorial.
20
Table 3.3 Other operations
21
CHAPTER 4
RESULT AND PERFORMANCE ANALYSIS
4.1 RESULT
The result of the project is found to be good as expected. All the functions are
working well without any errors or problems. The simple user interface gives users to
work out problems faster and get the results easily. The following figure shows how
the app looks on a mobile.
22
The following figure shows how the user interface looks like
23
The following figures show tan value of a number
24
The following figure shows factorial of a number
25
The following figures show the square root of a number.
Fig 4.7 Square root input Fig 4.8 Square root output
The app “Scientific Calculator” works well in all the aspects and
produces correct results for all types of operations like addition, subtraction,
multiplication, division, sin, cos , tan, square root, factorial ,etc. The app also shows
errors for any invalid inputs. So our app is working smoothly as expected.
26
CHAPTER 5
SUMMARY AND CONCLUSION
5.1SUMMARY
I succeeded in achieving the goals that I set out for my project,
namely to make a useful app “Scientific Calculator: using Java and XML. The
language java provides a great platform to develop android apps. The android app
for scientific calculation will be useful for many. And also it was achieved
successfully.
5.2 CONCLUSION
Technology is introducing new innovations day by day, thus reducing
the time required to do things. My project is a first step to do simple calculations as
well as some complex scientific calculations. As this will be available as software,
no need for physical calculators at all. So I believe that this became a good and
simple project.
27
. REFERENCES
[1] .B. DeRenzi, “Improving Community Health Worker Performance through
Automated SMS,” 5th ICTD, 2012, pp. 25-34.
[4].M. Densmore, “Experiences with Bulk SMS for Health Financing in AUganda,”
ACM CHI, 2012, pp. 383-398.
[5].M. Teófilo, “MobileDeck: Turning SMS into a Rich User Experience,” 6th
MobiSys, No. 33, 2009
[1]https://www.codeacademy.com/
[2]https://www.github.com/
[3]https://www.codepen.com/
[4]https://www.w3schools.com/
[1]https://www.theclassroom.com/
28
APPENDIX
SOURCE CODE:
CODES IN XML FILES
//activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="9"
tools:context=".MainActivity">
<TextView
android:id="@+id/input_user"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="@drawable/bgcolor2"
29
android:gravity="center|end"
android:hint="0"
android:maxLength="14"
android:padding="10dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="50sp" />
<TextView
android:id="@+id/sign_user"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center|end"
android:padding="10dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:background="@drawable/bgcolor"
android:textSize="32sp" />
30
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:orientation="horizontal"
android:weightSum="5">
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="btn_log"
android:text="log"
android:textAllCaps="false"
android:textColor="@color/WhiteText"
android:textSize="30sp" />
31
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="btn_ln"
android:text="ln"
android:textAllCaps="false"
android:background="@drawable/background_btn1"
android:textColor="@color/WhiteText"
android:textSize="30sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="btn_power"
32
android:background="@drawable/background_btn1"
android:text="xⁿ"
android:textAllCaps="false"
android:textColor="@color/WhiteText"
android:textSize="30sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="btn_root"
android:text="√"
android:background="@drawable/background_btn1"
android:textAllCaps="false"
android:textColor="@color/WhiteText"
android:textSize="30sp" />
<Button
33
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="btn_factorial"
android:background="@drawable/background_btn1"
android:text="!"
android:textAllCaps="false"
android:textColor="@color/WhiteText"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
34
android:background="@drawable/background_btn1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="5">
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:onClick="btn_sin"
android:text="sin"
android:textAllCaps="false"
android:background="@drawable/background_btn1"
android:textColor="@color/WhiteText"
android:textSize="30sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
35
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="btn_cos"
android:text="cos"
android:textAllCaps="false"
android:textColor="@color/WhiteText"
android:background="@drawable/background_btn1"
android:textSize="30sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:onClick="btn_tan"
android:text="tan"
android:textAllCaps="false"
android:background="@drawable/background_btn1"
36
android:textColor="@color/WhiteText"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="5">
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
37
android:onClick="btn_7"
android:text="7"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_8"
android:text="8"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
38
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_9"
android:text="9"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn2"
android:onClick="btn_add"
android:text="+"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
39
<ImageButton
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn2"
android:onClick="btn_delete"
android:src="@drawable/ic_backspace_black_24dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="5">
<Button
40
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_4"
android:text="4"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_5"
android:text="5"
android:textColor="@color/WhiteText"
41
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_6"
android:text="6"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn2"
42
android:onClick="btn_subtract"
android:text="-"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn2"
android:onClick="btn_clear"
android:text="C"
android:textColor="@color/WhiteText"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
43
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal"
android:weightSum="5">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:orientation="vertical"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="4">
44
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_1"
android:text="1"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_2"
45
android:text="2"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn1"
android:onClick="btn_3"
android:text="3"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
46
android:layout_weight="1"
android:background="@drawable/background_btn2"
android:onClick="btn_multiply"
android:text="×"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="4">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
47
android:layout_weight="0"
android:background="@drawable/background_btn1" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/background_btn1"
android:onClick="btn_0"
android:text="0"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
48
android:background="@drawable/background_btn1"
android:onClick="btn_dot"
android:text="."
android:textColor="@color/WhiteText"
android:textSize="32sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/background_btn2"
android:onClick="btn_divide"
android:text="÷"
android:textColor="@color/WhiteText"
android:textSize="32sp" />
</LinearLayout>
49
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="1">
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/background_btn2"
android:onClick="btn_equal"
android:text="="
android:textColor="@color/WhiteText"
android:textSize="32sp" />
50
</LinearLayout>
</LinearLayout>
</LinearLayout>
//border.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:shape="rectangle">
</LinearLayout>
CODES IN JAVA:
//MainActivity.java
package com.dataflair.scientificcalc;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
51
import android.widget.TextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
has_Dot = false;
@SuppressLint("SetTextI18n")
public void btn_0(View view) {
user_input.setText(user_input.getText() + "0");
}
@SuppressLint("SetTextI18n")
public void btn_1(View view) {
user_input.setText(user_input.getText() + "1");
}
52
@SuppressLint("SetTextI18n")
public void btn_2(View view) {
user_input.setText(user_input.getText() + "2");
}
@SuppressLint("SetTextI18n")
public void btn_3(View view) {
user_input.setText(user_input.getText() + "3");
}
@SuppressLint("SetTextI18n")
public void btn_4(View view) {
user_input.setText(user_input.getText() + "4");
}
@SuppressLint("SetTextI18n")
public void btn_5(View view) {
user_input.setText(user_input.getText() + "5");
}
@SuppressLint("SetTextI18n")
public void btn_6(View view) {
user_input.setText(user_input.getText() + "6");
}
@SuppressLint("SetTextI18n")
public void btn_7(View view) {
user_input.setText(user_input.getText() + "7");
}
53
@SuppressLint("SetTextI18n")
public void btn_8(View view) {
user_input.setText(user_input.getText() + "8");
}
@SuppressLint("SetTextI18n")
public void btn_9(View view) {
user_input.setText(user_input.getText() + "9");
}
@SuppressLint("SetTextI18n")
public void btn_dot(View view) {
if (!has_Dot) {
if (user_input.getText().equals("")) {
user_input.setText("0.");
} else {
user_input.setText(user_input.getText() + ".");
}
has_Dot = true;
}
54
has_Dot = false;
}
@SuppressLint("SetTextI18n")
public void btn_log(View view) {
sign = "log";
user_input.setText(null);
55
sign_Box.setText("log");
has_Dot = false;
}
@SuppressLint("SetTextI18n")
public void btn_ln(View view) {
sign = "ln";
user_input.setText(null);
sign_Box.setText("ln");
has_Dot = false;
}
@SuppressLint("SetTextI18n")
public void btn_sin(View view) {
sign = "sin";
user_input.setText(null);
56
has_Dot = false;
sign_Box.setText("sin");
}
@SuppressLint("SetTextI18n")
public void btn_cos(View view) {
sign = "cos";
user_input.setText(null);
has_Dot = false;
sign_Box.setText("cos");
}
@SuppressLint("SetTextI18n")
public void btn_tan(View view) {
sign = "tan";
user_input.setText(null);
has_Dot = false;
sign_Box.setText("tan");
}
sign_Box.setText("√");
@SuppressLint("SetTextI18n")
public void btn_equal(View view) {
if (sign == null) {
sign_Box.setText("Error!");
57
} else if (user_input.getText().equals("")) {
sign_Box.setText("Error!");
} else if ((sign.equals("+") || sign.equals("-") || sign.equals("*") ||
sign.equals("/")) && val_1.equals("")) {
sign_Box.setText("Error!");
} else {
switch (sign) {
default:
break;
case "log":
val_1 = user_input.getText().toString();
num1 = Double.parseDouble(val_1);
user_input.setText(Math.log10(num1) + "");
sign = null;
sign_Box.setText(null);
break;
case "ln":
val_1 = user_input.getText().toString();
num1 = Double.parseDouble(val_1);
user_input.setText(Math.log(num1) + "");
sign = null;
sign_Box.setText(null);
break;
case "power":
num1 = Double.parseDouble((val_1));
val_2 = user_input.getText().toString();
num2 = Double.parseDouble(val_2);
user_input.setText(Math.pow(num1, num2) + "");
sign = null;
sign_Box.setText(null);
break;
58
case "root":
val_1 = user_input.getText().toString();
num1 = Double.parseDouble((val_1));
user_input.setText(Math.sqrt(num1) + "");
sign = null;
sign_Box.setText(null);
break;
case "factorial":
val_1 = user_input.getText().toString();
num1 = Double.parseDouble((val_1));
int i = Integer.parseInt(val_1) - 1;
while (i > 0) {
num1 = num1 * i;
i--;
}
user_input.setText(num1 + "");
sign = null;
sign_Box.setText(null);
break;
case "sin":
val_1 = user_input.getText().toString();
num1 = Double.parseDouble((val_1));
user_input.setText(Math.sin(num1) + "");
sign = null;
sign_Box.setText(null);
break;
case "cos":
val_1 = user_input.getText().toString();
num1 = Double.parseDouble((val_1));
59
user_input.setText(Math.cos(num1) + "");
sign = null;
sign_Box.setText(null);
break;
case "tan":
val_1 = user_input.getText().toString();
num1 = Double.parseDouble((val_1));
user_input.setText(Math.tan(num1) + "");
sign = null;
sign_Box.setText(null);
break;
case "+":
val_2 = user_input.getText().toString();
num1 = Double.parseDouble(val_1);
num2 = Double.parseDouble(val_2);
answer = num1 + num2;
user_input.setText(answer + "");
sign = null;
sign_Box.setText(null);
break;
case "-":
val_2 = user_input.getText().toString();
num1 = Double.parseDouble(val_1);
num2 = Double.parseDouble(val_2);
answer = num1 - num2;
user_input.setText(answer + "");
sign = null;
sign_Box.setText(null);
break;
case "*":
val_2 = user_input.getText().toString();
60
num1 = Double.parseDouble(val_1);
num2 = Double.parseDouble(val_2);
answer = num1 * num2;
user_input.setText(answer + "");
sign = null;
sign_Box.setText(null);
break;
case "/":
val_2 = user_input.getText().toString();
num1 = Double.parseDouble(val_1);
num2 = Double.parseDouble(val_2);
answer = num1 / num2;
user_input.setText(answer + "");
sign = null;
sign_Box.setText(null);
break;
}
}
}
61
user_input.setText(user_input.getText().subSequence(0,
user_input.getText().length() - 1));
} else {
user_input.setText(user_input.getText().subSequence(0,
user_input.getText().length() - 1));
}
}
}
user_input.setText(null);
sign_Box.setText(null);
val_1 = null;
val_2 = null;
sign = null;
has_Dot = false;
}
62