MCPcopy Index your code
hub / github.com/careercup/ctci / main

Method main

java/Chapter 8/Question8_9/Question.java:5–36  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

3public class Question {
4
5 public static void main(String[] args) {
6 Directory root = new Directory("Food", null);
7 File taco = new File("Taco", root, 4);
8 File hamburger = new File("Hamburger", root, 9);
9 root.addEntry(taco);
10 root.addEntry(hamburger);
11
12 Directory healthy = new Directory("Healthy", root);
13
14 Directory fruits = new Directory("Fruits", healthy);
15 File apple = new File("Apple", fruits, 5);
16 File banana = new File("Banana", fruits, 6);
17 fruits.addEntry(apple);
18 fruits.addEntry(banana);
19
20 healthy.addEntry(fruits);
21
22 Directory veggies = new Directory("Veggies", healthy);
23 File carrot = new File("Carrot", veggies, 6);
24 File lettuce = new File("Lettuce", veggies, 7);
25 File peas = new File("Peas", veggies, 4);
26 veggies.addEntry(carrot);
27 veggies.addEntry(lettuce);
28 veggies.addEntry(peas);
29
30 healthy.addEntry(veggies);
31
32 root.addEntry(healthy);
33
34 System.out.println(root.numberOfFiles());
35 System.out.println(veggies.getFullPath());
36 }
37
38}

Callers

nothing calls this directly

Calls 3

addEntryMethod · 0.95
numberOfFilesMethod · 0.95
getFullPathMethod · 0.80

Tested by

no test coverage detected