@@ -42,35 +42,35 @@ public class AssessmentPartOne {
...
@@ -42,35 +42,35 @@ public class AssessmentPartOne {
// You should comment your code explaining what each part does
// You should comment your code explaining what each part does
//Setting up the Primitive int data type of sumOfNumbers and setting it's value to 0
//Setting up the Primitive int data type of total and setting it's value to 0
intsumOfNumbers=0;
inttotal=0;
//This section of the program states that if start is greater than the end value it will set the sumONumbers to be equal to -1 as specified by the brief it then returns this value.
//This section of the program states that if start is greater than the end value it will set the total to be equal to -1 as specified by the brief it then returns this value.
//If this is not the case it will continue onto the next elseif section
//If this is not the case it will continue onto the next elseif section
if(start>end){
if(start>end){
sumOfNumbers=-1;
total=-1;
returnsumOfNumbers;
returntotal;
}
}
//This section of the program states that if start is less than 0 or if end is less than or equal to 0 it will set the sumOfNumbers to be equal to -1 and it will then return this value
//This section of the program states that if start is less than 0 or if end is less than or equal to 0 it will set the total to be equal to -1 and it will then return this value
//If this is not the case it will continue onto the next elseif section
//If this is not the case it will continue onto the next elseif section
elseif(start<0||end<=0){
elseif(start<0||end<=0){
sumOfNumbers=-1;
total=-1;
returnsumOfNumbers;
returntotal;
}
}
//This section of the program states that if start plus 1 is equal to end it will set sumOfNumbers to equal -1.
//This section of the program states that if start plus 1 is equal to end it will set total to equal -1.
//If this is not the case it will continue onto the next section of the program
//If this is not the case it will continue onto the next section of the program
elseif(start+1==end){
elseif(start+1==end){
sumOfNumbers=-1;
total=-1;
returnsumOfNumbers;
returntotal;
}
}
//This section of the program states while start is less than end-1 it will increment the start value. It will then add start to the sumOfNumbers, It then returns this value.
//This section of the program states while start is less than end-1 it will increment the start value. It will then add start to the total, It then returns this value.
//It continues to run through this section of code until the start becomes equal to the end value -1
//It continues to run through this section of code until the start becomes equal to the end value -1