From e5cf5e6ca3c361e26af24e05bccc74b89cd9ec2d Mon Sep 17 00:00:00 2001 From: Subhopriyo Sadhukhan Date: Fri, 27 Sep 2019 21:19:47 +0530 Subject: [PATCH 01/10] Removed the issue --- src/simplejavacalculator/Calculator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/simplejavacalculator/Calculator.java b/src/simplejavacalculator/Calculator.java index d183266..fe13978 100644 --- a/src/simplejavacalculator/Calculator.java +++ b/src/simplejavacalculator/Calculator.java @@ -21,7 +21,12 @@ private Double calculateBiImpl() { return num2; } if (mode == BiOperatorModes.add) { - return num1 + num2; + if(num2!=0) { + return num1 + num2; + } + else { + return num1; + } } if (mode == BiOperatorModes.minus) { return num1 - num2; From 815cd966fdd7942885a529437fbc41a11d6c1b3e Mon Sep 17 00:00:00 2001 From: Subhopriyo Sadhukhan Date: Tue, 1 Oct 2019 20:49:05 +0530 Subject: [PATCH 02/10] Put a new check for Math.tan --- .idea/codeStyles/Project.xml | 116 ++++++++++++ .idea/libraries/SimpleJavaCalculator.xml | 9 + .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 220 +++++++++++++++++++++++ Simple-Java-Calculator.iml | 11 ++ src/simplejavacalculator/Calculator.java | 12 +- 8 files changed, 385 insertions(+), 3 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/libraries/SimpleJavaCalculator.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 Simple-Java-Calculator.iml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/libraries/SimpleJavaCalculator.xml b/.idea/libraries/SimpleJavaCalculator.xml new file mode 100644 index 0000000..2c48d19 --- /dev/null +++ b/.idea/libraries/SimpleJavaCalculator.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e208459 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..60716c0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..98b811f --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1569599057694 - - - 1569599387128 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 6d24e05f2e952131796a853ad35e0bbaff1af23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=99=9A=20PH=E2=91=A6=20de=20Soria=E2=84=A2=E2=99=9B?= Date: Wed, 30 Oct 2019 12:00:18 +1300 Subject: [PATCH 09/10] Delete Simple-Java-Calculator.iml --- Simple-Java-Calculator.iml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 Simple-Java-Calculator.iml diff --git a/Simple-Java-Calculator.iml b/Simple-Java-Calculator.iml deleted file mode 100644 index c90834f..0000000 --- a/Simple-Java-Calculator.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file From 631a86046d4661ddfb71edbbebbdb7b1b03344e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=99=9A=20PH=E2=91=A6=20de=20Soria=E2=84=A2=E2=99=9B?= Date: Wed, 30 Oct 2019 12:05:38 +1300 Subject: [PATCH 10/10] Fix indentation issues --- src/simplejavacalculator/Calculator.java | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/simplejavacalculator/Calculator.java b/src/simplejavacalculator/Calculator.java index e613518..220a594 100644 --- a/src/simplejavacalculator/Calculator.java +++ b/src/simplejavacalculator/Calculator.java @@ -22,12 +22,11 @@ private Double calculateBiImpl() { return num2; } if (mode == BiOperatorModes.add) { - if(num2!=0) { + if (num2 != 0) { return num1 + num2; } - else { - return num1; - } + + return num1; } if (mode == BiOperatorModes.minus) { return num1 - num2; @@ -89,12 +88,14 @@ public Double calculateMono(MonoOperatorModes newMode, Double num) { return Math.sin(num); } if (newMode == MonoOperatorModes.tan) { - if(num==0 || num%180==0) + if (num == 0 || num % 180 == 0) { return 0.0; - else if(num%90==0 && num%180!=0) + } + if (num % 90 == 0 && num % 180 != 0) return NaN; - else - return Math.tan(num); + } + + return Math.tan(num); } if (newMode == MonoOperatorModes.log) { return log10(num); @@ -102,11 +103,9 @@ else if(num%90==0 && num%180!=0) if (newMode == MonoOperatorModes.rate) { return num / 100; } - if(newMode == MonoOperatorModes.abs){ + if (newMode == MonoOperatorModes.abs){ return Math.abs(num); } - - // never reach throw new Error();