Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to read a txt file and print it as a tree form? Here is the text : ABC 1Central 11Mendy 111-Irving 112-Grey 113-LDS 2Hill

How to read a txt file and print it as a tree form?

Here is the text :

ABC 1Central 11Mendy 111-Irving 112-Grey 113-LDS 2Hill 21Tabler 211-Tosc 212-TAC 213-Hand 22Roth 3West 31WestApartments 32-GLS Center 4-BasementClub

Read and print it as a tree form:

->ABC //cursor is automatically at root

+Central

+Mendy

-Irving

-Grey

-LDS

+Hill

+Tabler

-Tosc

-TAC

-Hand

+Roth

+West

+WestApartments

-GLS Center

-BasementClub

public static NetworkTree readFromFile(String filename)

Generates the NetworkTree based on the file name that is passed in.

public static void writeToFile(NetworkTree tree, String filename)

Generates a text file that reflects the structure of the NetworkTree.

The format of the tree of the file should match the format of the input file.

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions