Commit 7a1442e4 authored by rehman.khan's avatar rehman.khan

assess

parent 65f6bc1d
...@@ -8,6 +8,9 @@ public class AssessmentPartOne { ...@@ -8,6 +8,9 @@ public class AssessmentPartOne {
// Add comments beside any changes you make // Add comments beside any changes you make
if((num1 > num3) && (num1 > num2)) if((num1 > num3) && (num1 > num2))
// this if statement means hat if num1 is greater than num3
// and num1 is greater than num2 return num1
{ {
return num1; return num1;
...@@ -16,6 +19,8 @@ public class AssessmentPartOne { ...@@ -16,6 +19,8 @@ public class AssessmentPartOne {
else if((num2 > num3) && (num2 > num1 )) else if((num2 > num3) && (num2 > num1 ))
{ {
return num2; return num2;
// if that isnt the case then if num2 is greater than num3
// and num2 is greater than num1 return num2
} }
else return num3; else return num3;
...@@ -36,14 +41,21 @@ public class AssessmentPartOne { ...@@ -36,14 +41,21 @@ public class AssessmentPartOne {
int sumOfSquares = 0; int sumOfSquares = 0;
if ((end >=0) && (start >=0) && (start<end) && (end > start+1)) if ((end >=0) && (start >=0) && (start<end) && (end > start+1))
// to compare to see if start and end are integer variables
// comparing that start is smaller than end
// and there are intergers between both variables
{ {
for (int p= start +1;p<end; p++) for (int p= start +1;p<end; p++)
// if the statements are true a loop can be used
// to add the numbers between start and end.
{ {
} }
} }
else return -1; else return -1;
// if all statements are false then return the value of -1
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