Report Group Mad. - 2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 29

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELGAUM

A Mini Project Report On

“Scientific Calculator”
Submitted in partial fulfilment of the requirements for the award of the 6 thsem of

BACHELOR OF ENGINEERING
IN
INFORMATION SCIENCE AND ENGINEERING

Submitted by:
SHAHWAR ALAM D AJAY KUMAR REDDY
[1VE18IS044] [1VE18IS015]

SAGAR BHUSHAN JHA MANAS RAJ


[1VE18IS042] [1VE18IS026]

Under the guidance of


Mr. GURUPRASAD Y K
Asst. Prof, Dept. of ISE

DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING


SRI VENKATESHWARA COLLEGE OF ENGINEERING
Affiliated to VTU Belgaum & Approved by AICTE New Delhi) an ISO 9001: 2008 Certified Kempegowda International Airport road,
Vidyanagar, Bengaluru, Karnataka, India-562157

2020-2021
SRI VENKATESHWARA COLLEGE OF
ENGINEERING
(Affiliated by A.I.C.T.E and approved by V.T.U)

CERTIFICATE

This is to certify that Mobile Application Development Mini Project [18CSMP68] work
entitled “ Scientific Calculator ” submitted in partial fulfilment of the requirement for VI
semester bachelor of engineering in Information science and engineering prescribed by the
Visvesvaraya Technological University, Belgaum is a result of the bonafide work carried
out by D AJAY KUMAR REDDY [1VE18IS015], SHAHWAR ALAM [1VE18IS044] ,
SAGAR BHUSHAN JHA [1VE18IS042] and MANAS RAJ [1VE18IS026] during the
academic year 2020-21. It is certified that all corrections/suggestions indicated for Internal
Assessment have been incorporated in the Report deposited in the departmental library. The
project report has been approved as it satisfies the academic requirements in respect of
Project work prescribed for the said Degree.

............................................... ........................................
Signature of Course Teacher Signature of HOD
Mr. GURUPRASAD Y K Dr.SHOBA M
Asst. Prof, Dept. of ISE H.O.D ,Dept. of ISE
SVCE, Bangalore SVCE, Bangalore

Name of the Examiners: Signature with Date


1:................................ 1:................................
2:................................ 2:................................
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any task would
be incomplete without complementing those who made it possible, whose guidance and
encouragement made our efforts successful.

My sincere thanks to highly esteemed institution SRI VENKATESHWARA COLLEGE


OF ENGINEERING for grooming up me in to be software engineer.

I express our sincere gratitude to Dr. SURESHA, Principal, SVCE, Bengaluru for providing
the required facility.

I am extremely thankful to Dr. SHOBA M, HOD of ISE, SVCE for providing support and
encouragement.

I am grateful to Mr. GURUPRASAD Y K , Asst. Professor, Dept. of ISE, who helped me to


complete this project successfully by providing guidance, encouragement and valuable
suggestion during entire period of the project. I thank all my computer science staff and
others who helped directly or indirectly to meet my project work with grand success.

Finally I am grateful to my parents and friends for their invaluable support guidance and
encouragement.

D AJAY KUMAR REDDY SHAHWAR ALAM


[1VE18IS015] [1VE18IS044]

SAGAR BHUSHAN JHA MANAS RAJ


[1VE18IS042] [1VE18IS026]
DEPARTMENT VISION
Global Excellence with Local relevance in Information Science and Engineering Education,
Research and Development.

DEPARTMENT MISION

M1. Strive for academic excellence in Information Science and Engineering through student
centric innovative teaching-learning process, competent faculty members, efficient
assessment and use of ICT.

M2. Establish Centre for Excellence in various vertical of Information Science and
Engineering to promote collaborative research and Industry Institute Interaction.

M3. Transform the engineering aspirants to socially responsible, ethical, technically


competent and value added professional or entrepreneur.
ABSTRACT
This work was centered on the design and implementation of a simple scientific calculator.
The study traced calculator system as a tool to completely change mathematical knowledge
and sophisticated problems solving strategies and advanced the field of a simulated engine
in mathematics. This project work also focused primarily on numbers and arithmetic
operation. The researcher investigated the manual system in detail with a view to finding
out the need to automate the system. Interestingly, the end result of the simple calculator
system was its ability to process number and operators and provides a useful result.
Therefore, this project will help immensely in the following way. Easy calculating of
tedious mathematical problems, easy retrieval of errors and it will also be of a good
assistance to any researcher on these topics.
SCIENTIFIC CALCULATOR

CHAPTER – 1

I. INTRODUCTION
1.1.Overview

By definition a Scientific Calculator is a calculator designed to help you calculate


science engineering and mathematics problems. It has way more buttons than your
standard calculator that just lets you do your four basic arithmetic operations of

 Addition
 Subtraction
 Multiplication
 Division

1.2. Features
While you can also do basic calculations such as addition, subtraction, multiplication
and division, that barely scratches the surface of the type of equations this calculator
can handle .

The Scientific Calculator has additional features that allow you to work with
exponents, logs and many more, which require more memory in order to perform
functions for the best result.

Here are few features of Scientific Calculator

 Basic Functions and Exponents


 Logarithms
 Sine, Cosine and tangent functions
 Scientific Notations
 Binary Functions

1.3. Need

Here are few needs of Scientific Calculator

 To Calculate basic functions such as Addition, Subtraction, division and


Multiplication.
 For any kind of Algebraic functions, we can use Scientific Calculator.

ISE,SVCE,2020-21 1
SCIENTIFIC CALCULATOR

 Along with negation, we can also raise numbers to another power and finds a
square root of a number or formula.
 In addition to this, we can use for advanced math like for unknown numbers
too
 Trigonometry functions also often pop up with scientific calculator

ISE,SVCE,2020-21 2
SCIENTIFIC CALCULATOR

CHAPTER - 2
II. SYSTEM SPECIFICATIONS
2.1. Software Requirements:
• Operating system - Windows XP or above

• Compiler - Android Studio

2.2. Hardware Requirements

• Hardware - Pentium

• RAM - 1GB

• Hard Disk - 20GB

• Monitor - 15” colour monitor

• Keyboard - 122 keys

ISE,SVCE,2020-21 3
SCIENTIFIC CALCULATOR

CHAPTER – 3
III. IMPLEMENTATION
3.1Introduction:
Implementation is the stage of the project where the code is turned out into a working
system. Thus it can be considered to be the most critical stage in achieving a successful new
system and in giving the user, confidence that the new system will work and be effective. The
implementation stage involves careful planning, investigation of the existing system and it’s
constraints on implementation, designing of methods to achieve changeover and evaluation of
changeover methods.

3.2.MainActivity.Java Source Code


package com.example.scalculator;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import org.mariuszgromada.math.mxparser.*;
public class MainActivity extends AppCompatActivity {

private TextView previousCalculation;


private EditText display;

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {

ISE,SVCE,2020-21 4
SCIENTIFIC CALCULATOR

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

previousCalculation = findViewById(R.id.previous_calculation_view);
display = findViewById(R.id.display_edit_text);
display.setShowSoftInputOnFocus(false);
}

public void updateText(String strToAdd)


{
String oldStr = display.getText().toString();
int cursorPos = display.getSelectionStart();
String leftStr = oldStr.substring(0, cursorPos);
String rightStr = oldStr.substring(cursorPos);

display.setText(String.format("%s%s%s", leftStr, strToAdd, rightStr));


display.setSelection(cursorPos + strToAdd.length());
}

public void zeroBTNPush(View view)


{
updateText(getResources().getString(R.string.zeroText));
}

public void oneBTNPush(View view)


{
updateText(getResources().getString(R.string.oneText));
}

public void twoBTNPush(View view)


{
updateText(getResources().getString(R.string.twoText));
}

ISE,SVCE,2020-21 5
SCIENTIFIC CALCULATOR

public void threeBTNPush(View view)


{
updateText(getResources().getString(R.string.threeText));
}

public void fourBTNPush(View view)


{
updateText(getResources().getString(R.string.fourText));
}

public void fiveBTNPush(View view)


{
updateText(getResources().getString(R.string.fiveText));
}

public void sixBTNPush(View view)


{
updateText(getResources().getString(R.string.sixText));
}

public void sevenBTNPush(View view)


{
updateText(getResources().getString(R.string.sevenText));
}

public void eightBTNPush(View view)


{
updateText(getResources().getString(R.string.eightText));
}

public void nineBTNPush(View view)


{
updateText(getResources().getString(R.string.nineText));
}

ISE,SVCE,2020-21 6
SCIENTIFIC CALCULATOR

public void multiplyBTNPush(View view)


{
updateText(getResources().getString(R.string.multiplyText));
}

public void divideBTNPush(View view)


{
updateText(getResources().getString(R.string.divideText));
}

public void subtractBTNPush(View view)


{
updateText(getResources().getString(R.string.subtractText));
}

public void addBTNPush(View view)


{
updateText(getResources().getString(R.string.addText));
}

public void clearBTNPush(View view){


display.setText("");
previousCalculation.setText("");
}

public void parOpenBTNPush(View view){


updateText(getResources().getString(R.string.parenthesesOpenText));
}

public void parCloseBTNPush(View view){


updateText(getResources().getString(R.string.parenthesesCloseText));
}

public void decimalBTNPush(View view){

ISE,SVCE,2020-21 7
SCIENTIFIC CALCULATOR

updateText(getResources().getString(R.string.decimalText));
}

public void backspaceBTNPush(View view){


int cursorPos = display.getSelectionStart();
int textLen = display.getText().length();

if (cursorPos != 0 && textLen != 0){


SpannableStringBuilder selection = (SpannableStringBuilder) display.getText();
selection.replace(cursorPos-1, cursorPos, "");
display.setText(selection);
display.setSelection(cursorPos-1);
}
}

public void equalBTNPush(View view){


String userExp = display.getText().toString();

previousCalculation.setText(userExp);

userExp = userExp.replaceAll(getResources().getString(R.string.divideText), "/");


userExp = userExp.replaceAll(getResources().getString(R.string.multiplyText), "*");

Expression exp = new Expression(userExp);


String result = String.valueOf(exp.calculate());

display.setText(result);
display.setSelection(result.length());
}

public void trigSinBTNPush(View view){


updateText("sin(");
}

ISE,SVCE,2020-21 8
SCIENTIFIC CALCULATOR

public void trigCosBTNPush(View view){


updateText("cos(");
}

public void trigTanBTNPush(View view){


updateText("tan(");
}

public void trigArcSinBTNPush(View view){


updateText("arcsin(");
}

public void trigArcCosBTNPush(View view){


updateText("arccos(");
}

public void trigArcTanBTNPush(View view){


updateText("arctan(");
}

public void naturalLogBTNPush(View view){


updateText("ln(");
}

public void logBTNPush(View view){


updateText("log(");
}

public void sqrtBTNPush(View view){


updateText("sqrt(");
}

public void absBTNPush(View view){


updateText("abs(");

ISE,SVCE,2020-21 9
SCIENTIFIC CALCULATOR

public void piBTNPush(View view){


updateText("pi");
}

public void eBTNPush(View view){


updateText("e");
}

public void xSquaredBTNPush(View view){


updateText("^(2)");
}

public void xPowerYBTNPush(View view){


updateText("^(");
}

public void primeBTNPush(View view){


updateText("ispr(");
}
}

3.3.App_Background.Xml Source Code


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient android:startColor="@color/blackStart"
android:centerColor="@color/blueBlack"
android:endColor="@color/greyEnd"
android:angle="45"/>
</shape>
</item>

ISE,SVCE,2020-21 10
SCIENTIFIC CALCULATOR

</selector>

3.4. Arithmetic_button_Background.xml Source Code


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/purpleBackground"></solid>
<stroke android:color="@color/purpleAccent" android:width="1.5dp"></stroke>
<corners android:radius="25dp"></corners>
</shape>
</item>
</selector>

3.5. Backspace.xml Source Code


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@android:drawable/ic_input_delete"
android:width="40dp"
android:height="40dp"/>
</selector>

3.6. Button_background.xml Source Code


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/blueBlack"/>
<corners android:radius="25dp"/>
<stroke android:width="1.5dp" android:color="@color/tanAccent"/>
</shape>
</item>

ISE,SVCE,2020-21 11
SCIENTIFIC CALCULATOR

</selector>
3.7. Clear_btn_background.xml Source Code
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/redBackground"/>
<stroke android:color="@color/redAccent" android:width="1.5dp"/>
<corners android:radius="25dp"/>
</shape>
</item>
</selector>
3.8. Equals_btn_background.xml Source Code
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/greenBackground"/>
<stroke android:color="@color/greenAccent" android:width="1.5dp"/>
<corners android:radius="25dp"/>
</shape>
</item>
</selector>

3.9 . Ic_ launcher_background.xml Source Code


<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"

ISE,SVCE,2020-21 12
SCIENTIFIC CALCULATOR

android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"

ISE,SVCE,2020-21 13
SCIENTIFIC CALCULATOR

android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"

ISE,SVCE,2020-21 14
SCIENTIFIC CALCULATOR

android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path

ISE,SVCE,2020-21 15
SCIENTIFIC CALCULATOR

android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />

ISE,SVCE,2020-21 16
SCIENTIFIC CALCULATOR

<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

ISE,SVCE,2020-21 17
SCIENTIFIC CALCULATOR

CHAPTER-4
IV. Snapshots

ISE,SVCE,2020-21 18
SCIENTIFIC CALCULATOR

Figure 1. Portrait of Scientific Calculator

Figure 2.Dyanamic presentation of Scientific Calculator

ISE,SVCE,2020-21 19
SCIENTIFIC CALCULATOR

Figure 3. Result

Figure 4. Landscape of Scientific Calculator

ISE,SVCE,2020-21 20
SCIENTIFIC CALCULATOR

Figure 5. Landscape of Scientific Calculator

ISE,SVCE,2020-21 21
SCIENTIFIC CALCULATOR

CHAPTER – 5
V. SUMMARY AND CONCLUSION:
With the theoretical inclination of our syllabus it becomes very essential to take the atmost
advantage of any opportunity of gaining practical experience that comes along. The building
blocks of this Major Project “SCIENTIFIC CALCULATOR” was one of these opportunities.
It gave us the requisite practical knowledge to supplement the already taught theoretical
concepts thus making us more competent as a computer engineer. The project from a personal
point of view also helped us in understanding the following aspects of project development:

• The planning that goes into implementing a project.

• The importance of proper planning and an organized methodology.

• The key element of team spirit and co-ordination in a successful project.

The project also provided us the opportunity of interacting with our teachers and to gain from
their best experience.

ISE,SVCE,2020-21 22
SCIENTIFIC CALCULATOR

REFERENCES
Android Studio (Website)
Stack overflow (Website)

ISE,SVCE,2020-21 23

You might also like