Commit ab9a4627 authored by mykel.macdonald's avatar mykel.macdonald

inital commit

parent 7805f22d
Pipeline #231 failed with stages
...@@ -7,7 +7,7 @@ public class AssessmentPartOne { ...@@ -7,7 +7,7 @@ public class AssessmentPartOne {
// Debug this method so it passes the unit test. // Debug this method so it passes the unit test.
// Add comments beside any changes you make // Add comments beside any changes you make
if (num1<num2) if (num1>num2) // I changed the < in between the "num1" and "num2" variables to >
{ {
if (num3>num1) if (num3>num1)
{ {
...@@ -26,7 +26,7 @@ public class AssessmentPartOne { ...@@ -26,7 +26,7 @@ public class AssessmentPartOne {
} }
else else
{ {
return num2 return num2; // I added a end line to this line
} }
} }
} }
...@@ -43,8 +43,24 @@ public class AssessmentPartOne { ...@@ -43,8 +43,24 @@ public class AssessmentPartOne {
// You should comment your code explaining what each part does // You should comment your code explaining what each part does
int sumOfSquares = 0; int sumOfSquares = 0;
int negativeInt = -1; // This gives a return if the sum cannot be calculated
if (start < 0) { // This means if the first number is negative to return the value of negativeInt being -1
return negativeInt;
}
if (end < 0 ) { // This means if the last number is negative to return the value of negativeInt being -1
return negativeInt;
}
if (end < start) { // This means if the last number is less that the first number then the negativeInt value will be displayed
return negativeInt;
}
if (end == start+1) { // This means if there are no numbers between the first and last then the value of negativeInt is displayed
return negativeInt;
}
for (int i=start+1; i<end; i++) { // This means the first number will be excluded by a value of one and the numbers before the last number are only included
sumOfSquares += i;
}
return sumOfSquares; return sumOfSquares;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment