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

3.37 Rating (126 Votes )

There are 3 Steps involved in it

Step: 1

package aprilaprill Import javaioFileNotFoundExceptio... blur-text-image

Get Instant Access with AI-Powered 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

Applied Linear Algebra

Authors: Peter J. Olver, Cheri Shakiban

1st edition

131473824, 978-0131473829

More Books

Students also viewed these Accounting questions