Beispiel #1
0
            msg = "Enter the CODE of the dest city."
            title = "Destination"
            dest = eg.enterbox(msg, title)

            list = [home, dest]
            msg = "Shortest path between " + str(list[0]) + " and " + str(list[1]) +\
                  " is: " + str(x.find_shortest_path(home,dest,list))
            eg.msgbox(msg)


    if str(choice) == "Statistics":
        msg = "Longest Flight: " + x.get_longest_flight().home +" to " + x.get_longest_flight().dest +\
                      "\nDistance: " + str(x.get_longest_flight().distance)+ "\n\n" +\
            "Shortest Flight: " + x.get_shortest_flight().home+" to " + x.get_shortest_flight().dest +\
                      "\nDistance: " + str(x.get_shortest_flight().distance) + "\n\n" +\
            "Distance of Average Flight: "+ str(x.get_avg_flight())+"\n\n" +\
            "Largest City: " + x.get_big_city().name + "\nPopulation: " + str(x.get_big_city().population)+ " \n\n" +\
            "Smallest City: " + x.get_small_city().name + "\nPopulation: " + str(x.get_small_city().population)+ " \n\n" +\
            "Average City Size: " + str(x.get_avg_city()) + "\n\n"+\
            "Cities w/ Most Connections: " + str(x.get_hub_city()) + " "+"\n\n"
        eg.msgbox(msg)

    if str(choice) == "Edit":
        title = "Edit Network"
        msg = "Choose an option"
        choices = ["Add a city", "Delete a city", "Add a route", "Delete a route", "Save"]
        choice = eg.buttonbox(msg, title, choices)

        if str(choice) == "Delete a route":
            msg = "Enter the CODE of the home city."
            title = "Home"
Beispiel #2
0
 def test_get_avg_flight(self):
     x = Graph('C:/Users/Anne/PycharmProjects/Assignment2/map_data.json')
     self.assertEqual(x.get_avg_flight(), 2300.276595744681)