001 package ps2; 002 003 import java.util.*; 004 import java.text.*; 005 006 007 /** 008 * <p> 009 * A WalkingRouteFormatter class knows how to create a textual 010 * description of directions from one location to another suitable for 011 * a pedestrian. 012 * </p> 013 * 014 * <p> 015 * Calling <tt>computeDirections</tt> should produce directions in the 016 * following form: 017 * </p> 018 * 019 * <p> 020 * <pre> 021 * Turn right onto Baker Street and walk for 20 minutes. 022 * Turn slight left onto MacGregor Street and walk for 8 minutes. 023 * Turn sharp right onto Burton street and walk for 3 minutes. 024 * Continue onto Connor Street and walk for 12 minutes. 025 * </pre> 026 * </p> 027 * 028 * <p> 029 * Each line should correspond to a single geographic feature of the 030 * route. In the first line, "Baker Street" is the name of the first 031 * geographical feature of the route, and "20 minutes" is the length 032 * of time that it would take to walk along the geographic feature, 033 * assuming a walking speed of 20 minutes per mile. The time in 034 * minutes should be reported to the nearest minute. Each line should 035 * be terminated by a newline and should include no extra spaces other 036 * than those shown above. 037 * </p> 038 **/ 039 public class WalkingRouteFormatter extends RouteFormatter { 040 041 /** 042 * <p> 043 * Computes a single line of a multi-line directions String that 044 * represents the instructions for walking along a single 045 * geographical feature. 046 * </p> 047 * 048 * <p> 049 * Calling <tt>computeLine</tt> with a GeoFeature instance and an 050 * initial heading should produce a newline-terminated String in 051 * the following form: 052 * </p> 053 * 054 * <p> 055 * <pre> 056 * Turn sharp left onto MacGregor Street and walk for 18 minutes. 057 * </pre> 058 * </p> 059 * 060 * <p> 061 * In the output above, "MacGregor Street" represents the name of 062 * the geographical feature, and "18 minutes" is the length of 063 * time that it would take to walk along the geographic feature, 064 * assuming a walking speed of 20 minutes per mile. The time in 065 * minutes should be reported to the nearest minute. Each line 066 * should be terminated by a newline and should include no extra 067 * spaces other than those shown above. 068 * </p> 069 * 070 * @requires 0 <= origHeading < 360 071 * @param geoFeature The geographical feature to traverse. 072 * @param origHeading The initial heading 073 * @return A newline-terminated <tt>String</tt> that gives 074 * directions on how to walk along this geographical feature. 075 **/ 076 public String computeLine(GeoFeature geoFeature, double origHeading) { 077 throw new RuntimeException("Not yet implemented"); 078 } 079 }