Skip to content

Commit c0a4634

Browse files
committed
modified calculator
1 parent ff3f59d commit c0a4634

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed
Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1+
// Advanced Calculator with error handling
12
public class Calculator {
2-
public int a;
3-
public int b;
4-
5-
public Calculator(int a,int b){
6-
this.a=a;
7-
this.b=b;
3+
public double add(double a, double b) {
4+
return a + b;
85
}
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;
6+
7+
public double subtract(double a, double b) {
8+
return a - b;
209
}
2110

22-
}
11+
// Add more methods to create more significant differences
12+
public String getVersion() {
13+
return "Calculator v2.0";
14+
}
15+
}

0 commit comments

Comments
 (0)