diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
new file mode 100644
index 0000000..a76a424
Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..30aa626
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 96cc43e..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf3..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index ba7052b..99202cc 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -5,11 +5,12 @@
@@ -24,7 +25,7 @@
-
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 6169877..3480a4a 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,6 @@
-
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java b/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java
index a0cb52b..44f283b 100644
--- a/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java
+++ b/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java
@@ -13,6 +13,9 @@ public class MainActivity extends AppCompatActivity {
Button add,sub,div,mul,one,two,three,four,five,six,seven,eight,nine,zero,equal,clear,decimal,clearall,percent,change,sign;
TextView edit2,edit1;
+ String[] history = new String[5];
+ String formula;
+ int count=0;
float value1,value2;
float ans=0;
boolean addition,subtraction,division,multiplication,answer;
@@ -219,22 +222,40 @@ public void onClick(View view) {
answer=true;
if(addition==true){
ans=value1+value2;
+ formula=Float.toString(value1)+"+"+Float.toString(value2)+System.getProperty("line.separator")+Float.toString(ans);
//addition=false;
}
else if(subtraction==true){
ans=value1-value2;
+ formula=Float.toString(value1)+"-"+Float.toString(value2)+System.getProperty("line.separator")+Float.toString(ans);
//subtraction=false;
}
else if(division==true){
ans=value1/value2;
+ formula=Float.toString(value1)+"//"+Float.toString(value2)+System.getProperty("line.separator")+Float.toString(ans);
//division=false;
}
else if(multiplication==true){
ans=value1*value2;
+ formula=Float.toString(value1)+"*"+Float.toString(value2)+System.getProperty("line.separator")+Float.toString(ans);
//multiplication=false;
}
edit1.setText(ans+"");
+
+ if(count<=4)
+ {
+ history[count]=formula;
+ count++;
+ }
+ else
+ {
+ for(int i =0; i<4; i++)
+ {
+ history[i]=history[i+1];
+ }
+ history[4]=formula;
+ }
}
catch (Exception e){
edit1.setText("error");
diff --git a/build.gradle b/build.gradle
index c33a638..f93d608 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,6 +3,7 @@
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
@@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
+ google()
}
}