November 25, 2014 · Public
I stuck in a string manipulating program in java and need help (f1) !!!
the description of the problem is as follows:
You will be provided with an input file which defines a graph and a series of questions relating to the graph. Your program will need to read this input file and output the answers to an output file.
The program must accept a single argument, a path to the input file. e.g. "~/input.txt”
The input file will be structured as follows:
The first line will be the graph definition, a single line of routes separated by spaces.
A route will be defined as AC5 (i.e. The distance from A to C is 5).
Following the problem definition each line will represent one of the following questions (The routes included in these questions are examples only).
DISTANCE CBAE What is calculated distance of the route CBAE? The answer should be the route, including distance. i.e. CBAE12
SHORTEST CA What is the shortest route from C to A? The answer should be the route, including distance. i.e. CBA12
POSSIBLE CA15 What are the possible routes from C to A with a maximum distance of 15? The answer should be all routes, including distances, separated by spaces. i.e. CBA8 CBADA12 CBDA11 CBDADA15 CEA12 CBEA15
The input file can contain any number of questions, in any order.
Please find an example ‘input.txt' attached.
Output the answers to a file named 'output.txt', one answer per line, in the following format:
DISTANCE CBAE = CBAE12