Commit 69f1fdc7 authored by benn.robinson's avatar benn.robinson

A1

parent 7805f22d
...@@ -7,7 +7,9 @@ public class AssessmentPartOne { ...@@ -7,7 +7,9 @@ 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) // Changed the symbol from "<" to ">" because originally num1 could not be the biggest number so the code was wrong.
{ {
if (num3>num1) if (num3>num1)
{ {
...@@ -26,7 +28,7 @@ public class AssessmentPartOne { ...@@ -26,7 +28,7 @@ public class AssessmentPartOne {
} }
else else
{ {
return num2 return num2; // added a semi colon because it finishes the return
} }
} }
} }
...@@ -44,8 +46,21 @@ public class AssessmentPartOne { ...@@ -44,8 +46,21 @@ public class AssessmentPartOne {
int sumOfSquares = 0; int sumOfSquares = 0;
int negativeAnswer = -1; //
if (start < 0)
{
return negativeAnswer;
}
else
{ for (int a = start; a < end; a++)
}
}
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