Answered step by step
Verified Expert Solution
Link Copied!

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:
Q1-A
Command: areneighbours
Parameters: 2 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 (0,1): Yes
Expected output on test data with input (1,2): No
Expected output on test data with input (3,4): Yes
Expected output on test data with input (0,4): Yes
Q1-B
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 (0,1,3,4,-1): Yes
Expected output on test data with input (0,1,2,3,4,-1): No
Expected output on test data with input (0,3,4,-1): Yes
Expected output on test data with input (0,2,3,1,4,-1): Yes
Q1-C
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 (0,1,3,4,-1): 1.8
Expected output on test data with input (0,3,4,-1): 1.4
Expected output on test data with input (0,2,3,1,4,-1): 2.5
Q1-D
Command: listneighbours
Parameters: 1 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 (0): 1234
Q1-E
Command: largestdistance
Parameters: 1 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 (0): 0.5
Expected output on test data with input (1): 0.8
Expected output on test data with input (2): 0.6
Expected output on test data with input (3): 0.9
Expected output on test data with input (4): 0.9
Q1-F
Command: isvalid
Parameters: None
Behaviour: The system assumes that distances are the same in both directions (e.g. the
distance from City 0 to City 1 is the same as City 1 to City 0). The system must output Yes if
this is true for all City pairs and No otherwise
Expected output on test data: Yes
Q1-G
Command: pathsfromto
Parameters: 2 integers
Behaviour: The system must read two integer parameters from the standard input stream and
then output the number of non-cyclic paths from the city specified by the first parameter to the
city specified by the second parameter.
Expected output on test data with input (0,4): 5
Q1-H
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: 03
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions