Class Trail

java.lang.Object
  extended byTrail

public class Trail
extends Object

This class models a ski trail at a CSE 142 SkiResort.


Constructor Summary
Trail(String trailName, int difficultyLevel, Lift mover)
          Create a new Trail using the given parameters.
 
Method Summary
 int getDifficulty()
          Get the difficulty level of this trail.
 String getName()
          Get the name of this trail.
 void roundTrip(Skier theSkier)
          Move a skier to the top of the trail, and then let them ski down, using the zoomUp and swoopDown methods.
 void swoopDown(Skier theSkier)
          Let a skier ski down the trail if they are at the top of the trail.
 String toString()
          Return a string description of this trail.
 void zoomUp(Skier theSkier)
          Move a skier to the top of the trail using the associated lift.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trail

public Trail(String trailName,
             int difficultyLevel,
             Lift mover)
Create a new Trail using the given parameters.

Parameters:
trailName - the name of this Trail
difficultyLevel - an int value, 0 or more. 0 is easy, 1 is more difficult, 2 is most difficult, 3 or more is expert only.
mover - the transportation to the top of the Trail
Method Detail

getName

public String getName()
Get the name of this trail.

Returns:
trail name

getDifficulty

public int getDifficulty()
Get the difficulty level of this trail.

Returns:
trail difficulty level

roundTrip

public void roundTrip(Skier theSkier)
Move a skier to the top of the trail, and then let them ski down, using the zoomUp and swoopDown methods.

Parameters:
theSkier - the person doing the skiing

zoomUp

public void zoomUp(Skier theSkier)
Move a skier to the top of the trail using the associated lift. If they are already at the top don't do anything.

Parameters:
theSkier - the person doing the skiing

swoopDown

public void swoopDown(Skier theSkier)
Let a skier ski down the trail if they are at the top of the trail. If the Skier is at the base of the trail already (ie, not at the top), do nothing. If they are at the top, then tell the Skier to swoop() and use setAtTop(false) to indicate that they are now at the bottom. If the trail difficulty is too high for this person, also tell the Skier to crash() after the swoop().

Parameters:
theSkier - the person doing the skiing

toString

public String toString()
Return a string description of this trail. The description should inlude information about the name of the trail, the difficulty level, and the associated Lift.

Returns:
a string description of this trail