"Develop An Android Calculator App.": Micro Project On
"Develop An Android Calculator App.": Micro Project On
A
Micro Project
On
“Develop an Android Calculator app.”
Submitted in partial fulfillment of the requirement for the award of
Diploma of Engineering
In
Computer Engineering
By
Siddhesh Shirkar
Prajot Naik
Mehul Choudhari
Aditya Wagh
Tanasri Patil
Department of Computer
Engineering
2024-25
CERTIFICATE
2024-25
This is to certify that the micro project entitled “Develop an Android Calculator app.”
has been submitted under the guidance of Karishma Datt in partial fulfillment of the
requirement for the award of Diploma of Engineering in Computer Engineering
from Maharashtra State Board of Technical Education.
GROUP MEMBERS
PART –A PLAN
1 Brief Introduction
2 Aim of the Micro-Project
3 Resources Required
PART –B OUTCOMES
1 Brief Description
2 Aim of Micro-Project
3 Course Outcomes Integrated
4 Actual Procedure Followed
5 Actual Resources Used
6 Outputs of the Micro-Projects
7 Skill Developed/ learning out of this Micro-Project
Develop an Android Calculator app. MAD 22617, Sem 6
PART-A PLAN
Calculator med make calculation easier. But this android based calculator project will not do
only simple calculations bot more than that. This new android calculator will store your
mathematical operations and your answers in their memory by which you can check your results
and operations which you have performed earlier. To make complex task easier, some extra
features has been added in this android calculator and these are like unit conversion, fractional
cakculations, trigonometric calculations and unit conversion alsu. This caktulator will not only
work in single mode, but different versions available under one hood like users can switch to
sesentific type or to engineering type and mach more.
4
VIVA COLLEGE OF DIPLOMA ENGG &
TECH,
Develop an Android Calculator app. MAD 22617, Sem 6
b) Users will able to check their previous results in history sections and also able to send
it to memory for further process.
c) Grouping of digits and decimal points will be handling by this android calculator.
5
VIVA COLLEGE OF DIPLOMA ENGG &
TECH,
Develop an Android Calculator app. MAD 22617, Sem 6
6
VIVA COLLEGE OF DIPLOMA ENGG &
TECH,
Develop an Android Calculator app. MAD 22617, Sem 6
PART-B OUTCOME
Calculator med make calculation easier. But this android based calculator project will not do only simple
calculations bot more than that. This new android calculator will store your mathematical operations and
your answers in their memory by which you can check your results and operations which you have
performed earlier. To make complex task easier, some extra features has been added in this android
calculator and these are like unit conversion, fractional calculations, trigonometric calculations and unit
conversion also. This calculator will not only work in single mode, but different versions available under
one hood like users can switch to scientific type or to engineering type and much more.
Existing System:
All we know that, while using simple calculator, we don't able to get all these features at one place and
mostly rely on manual work. Because of this extensive manual work, there is some delay and if in resh
condition then not able to get the correct results. There sometimes for the purpose of numerical and
statistical numerical, we need to make conversion of results into octal or hexadecimal format. which again
not provided through normal or scientific calculator.
Proposed System:
It's the android calculator which will remember your all input, imo its memory and separate all your digits
with commas automatically, so that it can be easily. identified. Calculation is sometime boring, but its
interactive look and versatile fester will provide you an exciting calculation environment. Because of touchy
nature of your nature, using smart editor, you don't have to write everything. If there's an error, you can
click on location and rectify it. It will provide all the basic operations in normal mode, but users mode
display for their use. also choose the scientific mode or fixed.
2. Users will able to check their previous results in history sections and also able to send it to memory for
further process.
3. Grouping of digits and decimal points will be handling by this android calculator.
4. Users will able to enter digits and operators which will also be displayed over the input panel.
5. Users can make conversions by using conversion unit section to make their calculation on hand.
7
Develop an Android Calculator app. MAD 22617, Sem 6
b) Users will able to check their previous results in history sections and also able to send
it to memory for further process.
c) Grouping of digits and decimal points will be handling by this android calculator
8
Develop an Android Calculator app. MAD 22617, Sem 6
9
Develop an Android Calculator app. MAD 22617, Sem 6
Android is an operating system that is built basically for Mobile phones. It is the Linux Kernel and
other open-source software and is developed by based Google. It is used for touchscreen mobile
devices such as smartphones and tablets but nowadays these ore used in Android Auto cars, TV,
watches, camera, etc. It has boon one of the best-selling OS for smartphones. Android OS was
developed by Android Inc. which Google bought in 2005. Various applications (apps) like games.
music player, camera, etc. are built for these smartphones for running on Android. Google Play
store features more than 3.3 million apps. The app is developed on an application known as
Android Studio. These executable apps are installed through a bundle or package called APK
(Android Package Kit).
Android Fundamentals
2. Android Componenta
The App components are the building blocks of Android. Each component has its own role and
life cycles Le from launching of an app till the end. Some of these components depend upon
others also.
Each component has a definite purpose. The four major app components are:
a) Activities
b) Services
c) Broadcast Receivers
d) Content Provider
Activities: It deals with the UI and the interactions to the screen. In other words, it is a User
Interface that contains activities, these can be one more depending upon the App. It starts when
the application is launched. At least one activity is always present which is known as
MainActivity.
Syntах:
10
Develop an Android Calculator app. MAD 22617, Sem 6
public class MainActivity extends Activity {
11
Develop an Android Calculator app. MAD 22617, Sem 6
// processes}
Services: Services are the background actives performed by the app, these might be long-running
operations like a user playing music whole surfing the Internet. A service might need other sub
services an to perform specific tasks. The main purpose of the Services is to provide non-stop
working of the app without breaking any interaction with the user.
Syntax:
Broadcast Receivers: A Broadcast is used to respond to messages from other applications or from
the System. For example, when the battery of the phone is low, then the Android OS fires a
Broadcasting message to launch the Battery Saver function se app, after receiving the message the
appropriate action is taken by the app. Broadcast Receiver is the subclass of BroadcastReceiver
class and each
Syntax:
Content Provider: Content Provider is used to transferring the data from one application to the
others at the request of the other application. These are handled by the class ContentResolver
class. This class implements a set of APIs (Application Programming tunerface) that enables the
other applications to perform the transactions. Any Content Provider mast implement the Parent
Class of
Syntax:
{}
}
12
Develop an Android Calculator app. MAD 22617, Sem 6
3. Structural Layout Of Android Studio
Manifest Folder: Android Manifest is an XML file that is the root of the project source set. It
describes the essential information about the app and the Android build tools, the Android Operating
System, and Google Play. It contains the permission that an app might need in order to perform a
specific task. It also contains the Hardware and the Software features of the app, which determines the
compatibility of an app on the Play Store. It also includes special activities like services, broadcast
receiver, content providers, package name, etc.
Java Folder: The JAVA folder consists of the java files that are required to perform the background
task of the app. It consists of the functionality of the buttons, calculation, storing, variables, variables,
toast (small popup message), programming function. The number of these files depends upon the type of
activities created.
Resource Folder: The res or Resource Folder consists of the various resources the used in the apathies
consists of sub-folders like draw able, layout, mipmap, raw, and values. The drawable consists of the
images. The layout consists of the XML, files that define the user interface layout. These are stored in
res.layout and are accessed as R.layout class. The raw consists of the Resources files like android files or
music files, etc. These accessed through R.row.filename, values used to store the hardcoded strings
(considered safe to store string values) values, integers, and colors It consists of various other directories
like:
13
Develop an Android Calculator app. MAD 22617, Sem 6
Gradle Files: Gradle is an advanced toolkit, which is used to manage the build process, that allows
defining the flexible custom build configurations. Each build configuration can define its own set of
code and resources while reusing the parts common to all versions of your app. The Android plugin for
Gradle works with the build toolkit to provide processes and configurable settings that are specific to
building and testing Android applications. Gradle and the Android plugin run independently of
Android Studies. This means that you can build your Android apps from within Android Studio. The
flexibility of the Android build system enables you to perform custom build configurations without
modifying your app's core source files.
Project/
app/
manifest/
AndroidManifest.xml
java/
MyActivity.java
res/
drawable/
icon.png
background.png
drawable-hdpi/
icon.png
background.png
layout/
14
Develop an Android Calculator app. MAD 22617, Sem 6
activity main.xml
info.xml
values/
strings.xml
The Lifecycle of Activity in Android App can be shown through this diagram:
15
Develop an Android Calculator app. MAD 22617, Sem 6
2. OnStart: This is called when the activity becomes visible to the user.
3. OnResume: This is called when the activity starts to interact with the user.
Android Studio is the official IDE (Integrated Development Environment) for Android app development
and it based on JetBrains IntelliJ IDEA software. Android Studio provides many excellent features that
enhance productivity when building Android apps, such as:
System Requirements:
16
Develop an Android Calculator app. MAD 22617, Sem 6
< TextView
android:layout_width="194dp"
android:layour_height="43dp"
android:layout_marginStart="114dp"
android:layuna_marginLeft="114dp"
android:layout_marginTop="58dp"
android:layour_marginEnd="103dp"
android:layout_marginRight="103dp"
android:layıma_marginBottom="502dp"
android:scrollbariaze="30dp"
android:text="Calculator"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="30dp"
app:layout_constraintBottom_toBottomOf="parom"
app:layout_constraintEnd_to_EndOf="parent"
app:layout_constraintStart_StartOf="parent"
app:layout_constraint_Top_to_TopOf="parent">
< EditText
android:id="@+id/num1"
android:layout_width="364dp"
android:layout_height="2dp"
android:layuna_marginStart="724p"
android:layout_margin_Top="70dp"
android:layour_marginEnd="71dp"
android:layout_marginBottom="415dp"
android:background="@android:color/white"
android:ems="10"
android:onClick="clearTextNum1"
android:inputType="sumber"
17
Develop an Android Calculator app. MAD 22617, Sem 6
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_EndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
< EditText
andmid:id="@num2"
android:layout_width="363dp"
android:layour_height="30dp"
android_layout_marginStart="72dp"
android_layuna_marginTop="112dp"
android:layout_marginlind="71dp"
android:layour_marginBotton="374dp"
android:background="@android:color/white"
android:ems="10"
android:onClick="clearTextNum2"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_StartOf="parent"
app:layout_constraint_Top_to_TopOf="parent"/>
< TextView
android:id="id/result"
android:layout_width="350dp"
android:layour_height="71dp"
android:layout_marginStart="41dp"
android:layout_marginTop="151dp"
android:layout_marginEnd="48dp"
android:layout_marginBottom="287dp"
android:background="@android:color/white"
android:text="result"
android:testColorLink="#673AB7"
android:textSize="25sp"
app:layout_constraintBottom_to_BottomOf="parent"
app:layout_constraintEnd_to_EndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
< Button
android:id="@+id/sum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
18
Develop an Android Calculator app. MAD 22617, Sem 6
android:layout_marginStart="16dp"
android:layout-margin-Top="292dp"
android:layout_marginEnd="307dp"
android:layout_marginBottoor="263dp"
android:backgroundTint="@android:color/holo_red _light"
android:onClick="dosum"
android:text="+"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_EndOf="parent"
app:layout_constraintStart_toštartOf="parent"
app:layout_constraintTop_to_TopOf="parent"/>
< Button
android:id="@+id/sub"
android:layout_width="wrap_conter"
android:layout_height="wrap_content"
android:layour_marginStart="210dp"
android:layout_marginTop="292dp"
android:layout_marginEnd="113dp"
android:layout_marginBottom="263dp"
android:backgroundTint="@android:color/holo_red_light"
android:onClick="doSub"
android:text="-"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constitaintEnd_toEndOf="parent"
app:layout_constraintHortzontal_bias="1.0"
app:layout_constraintStart_StartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.507"/>
< Button
android:id="@+id/div"
android:layour_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="307dp"
android:layout_marginTop="292dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="263dp"
android:backgroundTint="@android:color/holo_red_light"
android:onClick="doDiv"
android:text="/"
app:layout_constraintBottom_toBottomOf="parant"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
19
Develop an Android Calculator app. MAD 22617, Sem 6
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
< Button
android:id="@+id/mul"
android:layout_width="wrap_conter"
android:layout_height="wrap_content"
android:layour_marginStart="16dp"
android:layout_marginTop="356dp"
android:layout_marginEnd="307dp"
android:layout_marginBottom="199dp"
android:backgroundTint="@android:color/holo_red_light"
android:onClick="doMul"
android:text="x"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constitaintEnd_toEndOf="parent"
app:layout_constraintStart_StartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
< Botten
android:id=“@+id/button"
android:layout_width=“103dp”
android:layout_height="46dp"
android:layout_marginStart=“113dp”
android:layout_marginTop=“356dp"
android:layout_marginEnd=“200dp"
android:layout_marginBottom="199dp"
android:backgroundTint=“@android.coloc/holo_red_light"
andround:onClick="doMod"
android:text=“%(mod)”
app:layout_constraintBottom_toBottonOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent”
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias=“0.515” />
<Button
android:id=“@+id/pow”
android:layout _width="wrap_content"
android:layout_height=“wrap_content”
android:layout_marginStart="113dp”
android:layout_marginTop=“292dp"
android:layout_marginEnd=“210dp"
20
Develop an Android Calculator app. MAD 22617, Sem 6
android:layout_marginBotton=“263dp”
android:backgroundTint=“@android:color/holo_red_light”
android:onClick="doPow"
android:text="nl^n2"
app:layout_constraintBottum_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias=“0.0”
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.507” />
</android.constantlayout.widget.ConstraintLayout>
File: MainActivity.java
package com.example.calculator2;
import android.os.Bundle;
import com.google.android.material.snackbar Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ul.AppBarConfigsiration;
import andruidx.navigation.ui.NavigationUI;
import com.example.calculator2.databinding.ActivityMainBinding;
import android.view.Menu;
import android.view.MenuItem;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity
{
//checkAndClear();
// defining the edit text 1 to el
21
Develop an Android Calculator app. MAD 22617, Sem 6
e1 = (EditText) findViewById(R.id.num1);
22
Develop an Android Calculator app. MAD 22617, Sem 6
return false;
}
else{
//converting string to int.
num1 = Integer.parseInt(sl);
//converting string to int.
num2 = Integer.parseInt(s2);
}
return true;
}
public void doSum(View v) {
//get the Input
numbers if
(getNumbers()) {
int sum=numl+nam2;
t1.setText Integer.toString(sum));
}
else
{
t1.setText("Error Please enter Required Values");
}
}
public void clear TextNuml(View v) {
// get the input numbers
el.getText().clear();
}
public void clear TextNam2(View v) {
// get the input numbers
e2.getText().clear();
}
public void doPow(View v) {
//check AndClear();
//get the input
numbers if
(getNumbers()) {
double sum Math.pow(num1, 2);
t1.setText(Double.toString(sum));
}
Else
{
t1.setText("Error Please enter Required Values");
}
}
//a public method to perform subtraction
public void doSub(View v) {
//checkAndClear();
//get the input
numbers if
24
Develop an Android Calculator app. MAD 22617, Sem 6
(getNumbers()) {
int sum = num1 - num2;
t1.setText(Integer.toString(sum));
25
Develop an Android Calculator app. MAD 22617, Sem 6
}
else
{
t1.setText("Error Picase enter Required Values");
}
}
//a public method to perform
moltiplication public void doMul(View v)
{
//check AndClear();
// get the input numbers
if (getNumbers()) {
int sum = numl * num2;
t1.setText(Integer.toString/sum));
}
else
{
t1.setText("Error Please enter Required Values");
}
}
//a public method to perform Division
public void doDiv(View v) {
//checkAndClear();
//get the input
numbers if
(getNumbers()) {
27
Develop an Android Calculator app. MAD 22617, Sem 6
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity main);
e1 = (EditText) findViewById(R.id.numl);
// defining the edit text 2 to 2
e2 = (EditText) findViewById(R.id.num2);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//Inflate the menn; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(Menuftem item) {
//Handle action bar item clicks here. The actinn bar will
//automatically handle clicks on the Home/Up button, so long
//as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this.
R.id.nav_hos_ fragment_content_main);
return NavigationUI.navigateUp(navController, appBarConfiguration)
|| super.onSupportNavigateUp();
}
}
28
Develop an Android Calculator app. MAD 22617, Sem 6
29
Develop an Android Calculator app. MAD 22617, Sem 6
30
Develop an Android Calculator app. MAD 22617, Sem 6
31
Develop an Android Calculator app. MAD 22617, Sem 6
32
Develop an Android Calculator app. MAD 22617, Sem 6
33
Develop an Android Calculator app. MAD 22617, Sem 6
34
Develop an Android Calculator app. MAD 22617, Sem 6
35
Develop an Android Calculator app. MAD 22617, Sem 6
36