/* * ========================================================================== * MetroSystem.java: Create a model of the DC Metro System.... * * Written By : Mark Austin May 2006 * ========================================================================== */ import java.lang.Math; import java.util.*; import java.io.*; import java.text.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class MetroSystem { protected String sName; SymbolTable stations; Graph metro; // Constructor methods .... public MetroSystem() { stations = new SymbolTable(); metro = new Graph(); } public MetroSystem( String sName ) { this.sName = sName; stations = new SymbolTable(); metro = new Graph(); } // Create Metro Station objects ..... public void metroStations() { System.out.println("Creating metro stations..." ); // Create metro stations. (x,y) coordinates measured in miles // from Union Station. // .... FILL IN DETAILS HERE .... // Hint. ... Look in MetroStation.java ... // Add metro stations to the metro system database/symbol table. // .... FILL IN DETAILS HERE .... // Hint. ... Look in SymbolTable.java ... // Define stations along the green and red lines .... // .... FILL IN DETAILS HERE .... // Hint. ... Look in SymbolTable.java ... // Add track assignments to metro station descriptions .... // .... FILL IN DETAILS HERE .... // Hint. ... Look in SymbolTable.java ... } // Define details of the DC Metro System Network public void metroNetwork() { System.out.println("Creating metro network..." ); // Create metro station objects ..... // .... FILL IN DETAILS HERE .... e.g., // Hine. ... Look in Graph.java ..... // e.g., ms.metro.addEdge( "College Park", "Fort Totten"); } // Print details of the Metro System public void print() { System.out.println("DC Metro System"); System.out.println("==============="); // .... FILL IN DETAILS HERE .... } // Exercise methods in metro system model public static void main( String args[] ) { // Build model of metro stations and rail network ... MetroSystem ms = new MetroSystem("DC Metro"); ms.metroStations(); ms.metroNetwork(); // Retrieve and print details of individual metro stations .... System.out.println(""); System.out.println("Metro Station Details"); System.out.println("====================="); // .... FILL IN DETAILS HERE .... // Let's travel from "College Park" to "National Airport".... System.out.println(); System.out.println("Source: College Park"); System.out.println("Destination: National Airport"); System.out.println("============================="); // .... FILL IN DETAILS HERE .... // Travel distance from "College Park" to "National Airport".... // .... FILL IN DETAILS HERE .... System.out.println(); System.out.println("Distance"); System.out.println("================================"); System.out.println("College Park to National Airport = "); } }