Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your program must respond to the follow command as described below: Q 1 - A Command: areneighbours Parameters: 2 integers Behaviour: The system must read
Your program must respond to the follow command as described below:
QA
Command: areneighbours
Parameters: integers
Behaviour: The system must read in two integers from the standard input stream then output
a Yes if the two cities represented by those numbers are neighbours or No otherwise.
Expected output on test data with input : Yes
Expected output on test data with input : No
Expected output on test data with input : Yes
Expected output on test data with input : Yes
QB
Command: ispath
Parameters: A set of integers ending in a negative number
Behaviour: The system must read in a set of city numbers from the standard input stream
until it encounters a negative number. It must then say if the set of cities are connected by a
valid path by either outputting Yes or No
Expected output on test data with input : Yes
Expected output on test data with input : No
Expected output on test data with input : Yes
Expected output on test data with input : Yes
QC
Command: pathlength
Parameters: A set of integers ending in a negative number
Behaviour: The system must read in a set of city numbers from the standard input stream
until it encounters a negative number. It must then output the total distance along the path
connecting those cities. You may assume the path is valid.
Expected output on test data with input :
Expected output on test data with input :
Expected output on test data with input :
QD
Command: listneighbours
Parameters: integer
Behaviour: The system must read in a city number from the standard input stream and then
output all of the cities which are directly connected to it in ascending numerical order
Expected output on test data with input :
QE
Command: largestdistance
Parameters: integer
Behaviour: The system must read in a city number from the standard input stream and then
output the largest distance to one of its neighbouring cities.
Expected output on test data with input :
Expected output on test data with input :
Expected output on test data with input :
Expected output on test data with input :
Expected output on test data with input :
QF
Command: isvalid
Parameters: None
Behaviour: The system assumes that distances are the same in both directions eg the
distance from City to City is the same as City to City The system must output Yes if
this is true for all City pairs and No otherwise
Expected output on test data: Yes
QG
Command: pathsfromto
Parameters: integers
Behaviour: The system must read two integer parameters from the standard input stream and
then output the number of noncyclic paths from the city specified by the first parameter to the
city specified by the second parameter.
Expected output on test data with input :
QH
Command: mostconnected
Parameters: None
Behaviour: The system must output all of the city which share the maximum number of direct
connections ignoring distances
Expected output on test data:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started