Given a water pipe network as an input and the source of the water. You need to determine
if water can be delivered to every junction in the water network.
Write a program called HydroCheck.java that reads in a water pipe network and a source
junction, and returns a list of all junctions that are not receiving any water.
Input
The input comprises a number of lines divided into three sections. The first section of lines
lists all the junctions in the network. Each line consists of a single name followed by a space
and an integer denoting the “height above sea-level” of the junction. For example,
Alpha 20
denotes that junction Alpha is at 20 meters above sea-level. The section is terminated by a
line containing the word done.
The second section is list of pipe segments. Each pipe segment is denoted by the junctions
on its ends. Each line consists of two junction names denoting a pipe between the two
junctions. All names in this section should be from the list in the previous section. I.e.,
there will be no new names. For example,
Alpha Bravo
Denotes a pipe between junction Alpha and junction Bravo. The section is terminated by a
line containing the word done.
The last section contains a single line that has a single junction name, denoting the water
source of the pipe network. (See Example section.)
Java assignment

0 comments