So im writing a method for my computer science class in which im trying to make a kinda like walking path thing. What i want to do is test the methods where the isLevelSegment part will return true if the difference between the maximum and minimum elevation in the walking path segment is less than or equal to ten meters and the isDifficult method is trying to see if there are 3 or more elevation changes in a path ( elevation changes are at least 30 meters up or down ). All my code is written [ idk if its correct or not, i think it is ] and basically and idk why im having a really hard time writing the main method to test it. Help?
public class Lab11 {
public class WalkingPath
{
private int[] markers;
public boolean isLevelSegment (int start, int end )
{
int min = 1;
int max = 0;
for (int i = start; i<= end ; i ++)
{
if (markers[i] > max)
max = markers[i];
if (markers[i] < min || min == -1)
min = markers [i];
}
if ((max - min) <= 10)
return true;
else
return false;
}
public boolean isDifficult ()
{
int changes = 0;
for ( int i = 1 ; i< markers.length ; i ++)
{
if ((markers[i] - markers [i - 1]) >= 30)
changes ++;
}
if (changes >= 3)
return true;
else
return false;
}
}
}