2010 Trail

<< 2010APLine | APQuestionsTrailIndex | 2010GridChecker >>

question

Trail.java


public class Trail
{
   private int[] markers;
   public Trail(int[] markers)
   {
       this.markers=markers;
    }
   public boolean isLevelTrailSegment(int start, int end)
   {
       return false;
   }
   public boolean isDifficult()
   {
       return false;
   }
}

TrailTester.java


public class TrailTester
{
    public static void main(String[] args)
    {
       int[]  markers1 ={100, 150, 105, 120, 90, 80, 50, 75, 75, 70, 80, 90, 100};
       Trail trail1 = new Trail(markers1);
       System.out.println("isLevelTrailSegment(7,10) should be true: "+trail1.isLevelTrailSegment(7,10));
       System.out.println("isLevelTrailSegment(2,12) should be false: "+trail1.isLevelTrailSegment(2,12));
       System.out.println("isDifficult() for trail1 should be true: "+trail1.isDifficult());
       int[] markers2 = { 10, 10, 10};
       Trail trail2 = new Trail(markers2);
       System.out.println("isDifficult() for trail2 should be false: "+trail2.isDifficult());
    }
}