Download HIT3181 Assignment 1
Transcript
HIT3037/7037 – Assignment 1 City 4 Sydney City 5 Alice Springs City 6 Brisbane 1424 1534 2315 873 2259 1915 4131 3937 4435 6 5 0 2958 1122 2958 0 3210 1122 3210 0 6 5 3937km 3 1915km 2259km 1122km 4 2 725km 1 Figure 1. Total distance = 9958 km for Network Topology 1. 2259km 1122km 3 873km 3432km 4 2 725km 1 Figure 2. Total distance = 8411 km for Network Topology 2. Program Input: One essential input to your program is a file (with file extension .txt), which gives the total number of city records (in the first line) and summarizes the connection distances among cities (in the remaining lines). When two cities are forbidden to be directly connected due to geography, topography and climate factors, their distances will be marked as “N” in the file. Two input files are provided to you for testing purposes. Cities6.txt records every distance in Table 1, implying that each city can be directly connected to any other city. Cities12.txt has records for 12 cities, but some pairs of these 12 cities are forbidden to be directly connected. More different input files (those with unusual and invalid records) are worth to be included in your software testing. Your program will run slow if the number of cities is large, so in this assignment, we will only test your program with 12 cities at maximum. Design Requirements: Your program must have at least the following six classes: Assign2, WirelessNet, SpanningTreeAlg and its two subclasses, and InvalidUserInputException. Class Assign2 is a JFrame (a GUI window). 1. contains a main() function. Executing “java Assign2 directory_name/input_file_name.txt” or “java Assign2” in DOS should make the JFrame visible. 2. lets WirelessNet to read and process the file after obtaining a valid directory and file name. If no input file is given in the command line or if the given directory or input file name is invalid, your program should pop up a warning message and ask the user to provide a valid directory and file name. 3. has the following basic properties. a. Title: WirelessNet + your student ID(s) – no “student name” should be shown in the title b. Some GUI components: for the user to invoke different functions of the system, such as • finding spanning trees for many inputs files given with a chosen algorithm • presenting each search step/result of the chosen algorithm in graphical and descriptive forms. Tables 2 and 3 are given here to illustrate these. Your program should present at least their 1st, 2nd, 4th, 5th columns. This task demands you to decide how to index each city, where to HIT3037/7037 Programming in Java Page 2 of 9