Programming with
Data Structures and Algorithms

Filesystem... in Java!

Recall Filesystem from your Racket days. Reimplement exercises 16.3.2-16.3.4 and the Challenge question in Java. Please implement your own data structures instead of using those built into Java (e.g., lists).

In addition, please convert the following Racket example into Java in your main method:

(define hang (make-file 'hang 8 empty)) 
(define draw (make-file 'draw 2 empty))
(define read (make-file 'read! 19 empty))
(define one  (make-file 'part1 99 empty))
(define two  (make-file 'part2 52 empty))
(define thre (make-file 'part3 17 empty))
(define rdme (make-file 'read 10 empty))

(define Code (make-dir 'Code empty (list hang draw)))
(define Docs (make-dir 'Docs empty (list read)))
(define Libs (make-dir 'Libs (list Code Docs) empty)))
(define Text (make-dir 'Text empty (list one two three)))
(define Top (make-dir 'TS (list Text Libs) (list rdme)))

Then call each method (the Java-ized version of how-many, du-dir, find?, and find) on Top.


Turning in: