Uploaded by lsarson10

COIS 3020 - Assignment 1 Corrected

advertisement
Assignment 1: Roaming the Skies
COIS 3020 – Winter 2022
Due: 15th of February by 11:59PM
Air Canada, the nation’s flag carrier was founded in 1937 by the Canadian Parliament. It was first known as
Trans-Canada Airlines and did not assume the current name until 1965. Throughout its history Air Canada‘s
routes (pictured below, source: Air Canada) have constantly expanded to include a wide array of
international and domestic locations. In graph terms each airport is a vertex (node) and each route is a
directed edge.
Transport Canada designates 13 airports as international airports:
Airport Name
Calgary International Airport
Edmonton International Airport
Fredericton International Airport
Gander International Airport
Halifax Stanfield International Airport
Greater Moncton Roméo LeBlanc International Airport
Montréal–Trudeau International Airport
Ottawa Macdonald–Cartier International Airport
Québec/Jean Lesage International Airport
St. John's International Airport
Toronto Pearson International Airport
Vancouver International Airport
Winnipeg International Airport
Code
YYC
YEG
YFC
YQX
YHZ
YQM
YUL
YOW
YQB
YYT
YYZ
YVR
YWG
The route map of Air Canada can be repereseted as a graph using an adjacency list. We can assume that all
Air Canada flights from Canada will originate from one the aforementioned 13 airports. Our goal is to
create a graph that will help find routes for passengers. You can add destinations/return flights to these
airports as you please (they do not have to be real routes).
class AirportNode{
public string Name {get; set;} //property for name field.
public string Code {get; set;} //property for code field.
public List<AirportNode> Destinations {get; set;} //property for list of destinations.
public AirportNode(string name, string code) {…} //constructor 5%
AddDestination (AirportNodedestAirport) {…} //method to add destination. 5%
RemoveDestination (AirportNode destAirport) {…} //method to remove destination. 5%
ToString() {…} //ToString method overload to print out airport name, code, and list of deestinations. 5%
}
class RouteMap{
private List <AirportNode> A; //List of airport nodes.
public RouteMap() {…} //RouteMap constructor. 5%
public bool FindAirport(string name) {…} //Method to find airport by name. 5%
public bool FindAirport(string code) {…} //Method to find airport by code. 5%
public bool AddAirport(AirportNode a){…} //Method to add airport node. Duplicates not allowed. 5% public
bool RemoveAirport(AirportNode a) {…} //Method to remove airport node. Node must exist. 5% public bool
AddRoute(AirportNode origin, AirportNode dest) {…} 5%
public bool RemoveRoute (AirportNode origin, AirportNode dest {…} 5%
}
Task 1: Implement each of the classes with their corresponding fields, properties, constructors, and
methods. Keep the following in mind:
•
•
•
•
Each route is directed.
Only one route can exist between two airports. For example, Toronto Pearson can only
appear in Calgary International Airport’s destination list once.
A ToString method for the RouteMap will help!
Task 1 is worth 55% in total.
Task 2: Using a breadth first search, implement a method named FastestRoute(AirportNode origin,
AirportNode Destination) which outputs the shortest path between two given airports. 15%
Task 3: Implement a main method (not necessarily a main method anymore after .NET 6 I suppose) to
create your own Route Map and to drive your test cases. 5%
Task 4: Draw your own connected Route Map and prepare your test cases. Include the map, test cases,
and test results in a separate .pdf test document. 20%
•
•
•
If no testing document is included the assignment will not be marked.
Each testing document must include
1.
A named test case.
2.
A description of the test.
3.
The expected output.
4.
The actual output (a screenshot).
You must test for every edge case.
Task 5: Inline documentation (comments). 5%
Submit your code and include your testing document in a zip file to the dropbox on Blackboard by the due
date. This assignment must be completed in groups of 2-4 people. Individual submissions are not allowed
unless written permission is granted. One person from your group must submit the assignment (write your
names in the testing document and in a comment above the main method please). Every business day your
assignment is late, a 10% late penalty will be applied. Submissions will not be accepted after 5 business
days.
Download