Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started