001    package ps2;
002    
003    import java.text.DecimalFormat;
004    
005    
006    /**
007     * <p>
008     * The DrivingRouteFormatter class creates a textual description of
009     * directions for traversing a route that are suitable for a driver of
010     * a vehicle.
011     * </p>
012     *
013     * <p>
014     * Calling <tt>computeDirections</tt> should produce directions in the
015     * following form:
016     * </p>
017     *
018     * <p>
019     * <tt>
020     * Turn right onto Baker Street and go 1.2 miles.<br />
021     * Turn slight left onto MacGregor Street and go 0.8 miles.<br />
022     * Turn sharp right onto Burton street and go 2.3 miles.<br />
023     * Continue onto Connor Street and go 1.1 miles.<br />
024     * </tt>
025     * </p>
026     *
027     * <p>
028     * Each line should correspond to a single geographic feature of the
029     * route.  In the first line, "Baker Street" is the name of the first
030     * geographical feature of the route, and "1.2 miles" is the length of
031     * the geographic feature.  The length should be reported to
032     * tenth-of-a-mile precision. Each line should be terminated by a
033     * newline and should include no extra spaces other than those shown
034     * above.
035     * </p>
036     **/
037    public class DrivingRouteFormatter extends RouteFormatter {
038    
039        // You can use this object to round floating point values to one
040        // decimal place.
041        private static final DecimalFormat formatter = new DecimalFormat("0.0");
042    
043    
044        /**
045         * <p>
046         * Computes a single line of a multi-line directions String that
047         * represents the instructions for traversing a single
048         * geographical feature.
049         * </p>
050         *
051         * <p>
052         * Calling <tt>computeLine</tt> with a GeoFeature instance and an
053         * initial heading should produce a newline-terminated String in
054         * the following form:
055         * </p>
056         *
057         * <p>
058         * <tt>
059         * Turn sharp left onto MacGregor Street and go 0.8 miles.<br />
060         * </tt>
061         * </p>
062         *
063         * <p>
064         * In the output above, "MacGregor Street" represents the name of
065         * the geographical feature, and "0.8 miles" is the length of the
066         * geographical feature.  The length should be reported to
067         * tenth-of-a-mile precision.  The String should be terminated by
068         * a newline and should include no extra spaces other than those
069         * shown above.
070         * </p>
071         *
072         * @requires 0 &lt;= origHeading &lt; 360
073         * @param geoFeature The geographical feature to traverse.
074         * @param origHeading The initial heading
075         * @return A newline-terminated <tt>String</tt> that gives
076         * directions on how to traverse this geographical feature.
077         **/
078        public String computeLine(GeoFeature geoFeature, double origHeading) {
079            throw new RuntimeException("Not yet implemented");
080        }
081    }