Question: Write a Java program that 1. Selects a text file from your computer using either a Java Swing JFileChooser or a JavaFX FileChooser, which starts

Write a Java program that

1. Selects a text file from your computer using either a Java Swing JFileChooser or a JavaFX FileChooser, which starts out showing the files in the same directory from which the program was executed.[1]

2. Reads the selected text file. The text file will form an adjacency matrix representation of a graph.

3. Selects the action to perform from a list of seven actions, plus exit. (Five of those actions will be stubs at this time.)

4. The Action: Writes a description of the graph, determined from the text file, to an output file in the same directory as the input file. If the input file is abc.txt, the output file is abc_out.txt.

As will always be the case in this class, the program must be written in Java and must run on the University Windows computer systems. To ensure this I strongly recommend that you:

1. Use only Oracle Java 8 SE and earlier constructs, and

2. Test it on the University systems before submission if you have any doubts about its ability to run on the University Windows.

Submit the Java source code to the open Deliverable io submission folder. (ioA, ioB, or ioC). Just submit the source code, not a full Eclipse package.

Description of the File:

All the input files in this course will look something like this. Note that all columns of data are separated by 1 or more spaces:

~ val AAA BB C DDD E

Alfa x ~ > ~ 99 fig

Bravo 67 999 -42 3 x ==

Charlie ~ ~ 4 ~ yz 9

Delta 4e 3 22 x ~ !=2

Echo yes ~ ~ ~ d>e 33

The first row is a header row.

The first ~ is merely a placeholder. All files will have this at the beginning of the header row.

val is a column label for values

The rest of the strings are mnemonics for the nodes of the graph. They are alphanumeric and do not contain spaces.

Each other row describes one node and its outgoing edges.

The first column contains the name of the node (e.g., Alfa)

[1] If you use Eclipse, this could be either the src directory or the directory just above it.

The string in the val column is the value of the node, which may be numeric, but which will certainly always consist of a string of printable characters. The character ~ by itself stands for no value

For the rest of the columns, if there is no edge going from the node to another node, there is a ~ in the appropriate column.

If there is anything else in that column, that is the label of the edge. For some deliverables, this will be numeric, for others it may not be. Note that self edges are allowed.

Output:

The output should describe the graph in words. The best way to explain this is in regard to the sample graph above. The output for this file should be:

Node Alfa, mnemonic AAA, value x

Alfa has edge to Bravo labeled >

Alfa has edge to Delta labeled 99

Alfa has edge to Echo labeled fig

Alfa has edge from Bravo labeled 999

Alfa has edge from Delta labeled 3

Node Bravo, mnemonic BB, value 67

Bravo has edge to Alfa labeled 999

Bravo has edge to Bravo labeled -42

Bravo has edge to Charlie labeled 3

Bravo has edge to Delta labeled x

Bravo has edge to Echo labeled ==

Bravo has edge from Alfa labeled >

Bravo has edge from Charlie labeled b

Bravo has edge from Delta labeled 22

Node Charlie, mnemonic C, no value

Charlie has edge to Bravo labeled 4

Charlie has edge to Delta labeled yz

Charlie has edge to Echo labeled 9

Charlie has edge from Bravo labeled 3

Charlie has edge from Delta labeled x

Node Delta, mnemonic DDD, value 4e

Delta has edge to Alfa labeled 3

Delta has edge to Bravo labeled 22

Delta has edge to Charlie labeled x

Delta has edge to Echo labeled !=2

Delta has edge from Alfa labeled 99

Delta has edge from Bravo labeled x

Delta has edge from Charlie labeled yz

Delta has edge from Echo labeled d>e

Node Echo, mnemonic E, value yes

Echo has edge to Delta labeled d>e

Echo has edge to Echo labeled 33

Echo has edge from Alfa labeled fig

Echo has edge from Bravo labeled ==

Echo has edge from Charlie labeled 9

Echo has edge from Delta labeled !=2

Echo has edge from Echo labeled 33

The order in which the nodes, and edges incident on a node, print out is not important.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!