Skip to content
Snippets Groups Projects
Commit 5a3e847f authored by Stian Andersen Negård's avatar Stian Andersen Negård
Browse files

yeahboi

parent 178ce525
No related branches found
No related tags found
No related merge requests found
Pipeline #72197 passed
......@@ -70,9 +70,9 @@ public class CalculatorResource {
public int subtraction(String expression){
String[] split = expression.split("[-]");
int length = split.length;
int result = 0;
for(int i = 0; i<length; i++){
int result = Integer.parseInt(split[0]);
for(int i = 1; i<length; i++){
int number = Integer.parseInt(split[i]);
result -= number;
}
......@@ -82,9 +82,9 @@ public class CalculatorResource {
public int multiplication(String expression){
String[] split = expression.split("[*]");
int length = split.length;
int result = 0;
int result = Integer.parseInt(split[0]);
for(int i = 0; i<length; i++){
for(int i = 1; i<length; i++){
int number = Integer.parseInt(split[i]);
result *= number;
}
......@@ -94,9 +94,9 @@ public class CalculatorResource {
public int division(String expression){
String[] split = expression.split("[/]");
int length = split.length;
int result = 0;
int result = Integer.parseInt(split[0]);
for(int i = 0; i<length; i++){
for(int i = 1; i<length; i++){
int number = Integer.parseInt(split[i]);
result /= number;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment