We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ff3f59d commit c0a4634Copy full SHA for c0a4634
src/main/java/com/thealgorithms/student/Calculator.java
@@ -1,22 +1,15 @@
1
+// Advanced Calculator with error handling
2
public class Calculator {
- public int a;
3
- public int b;
4
-
5
- public Calculator(int a,int b){
6
- this.a=a;
7
- this.b=b;
+ public double add(double a, double b) {
+ return a + b;
8
}
9
- public int add(){
10
- return this.a+this.b;
11
- }
12
- public int substract(){
13
- return this.a-this.b;
14
15
- public int multiply(){
16
- return this.a*this.b;
17
18
- public int divide(){
19
- return this.a/this.b;
+
+ public double subtract(double a, double b) {
+ return a - b;
20
21
22
-}
+ // Add more methods to create more significant differences
+ public String getVersion() {
+ return "Calculator v2.0";
+ }
+}
0 commit comments