Created
September 13, 2016 10:22
-
-
Save joakiti/a6f667853aa39ef57b12dde54f4ddad7 to your computer and use it in GitHub Desktop.
hejhejhejhej
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class BigForest { | |
private ArrayList<Tree> trees; | |
private int a; | |
public BigForest() // Opgave i | |
{ | |
trees = new ArrayList<>(); | |
} | |
// Opgave 2 | |
public void show() { | |
for (Tree t : trees){ | |
t.show(); | |
} | |
} | |
public void GrowOneYear() { | |
for (Tree g : trees) { | |
g.GrowOneYear(); | |
} | |
} | |
// Opgave 3 | |
public void addFile(Tree t) { | |
trees.add(t); | |
} | |
public void growManyYears(int n) { | |
a = 0; | |
while ( a < n ) { | |
a++; | |
for (Tree t : trees) { | |
t.GrowOneYear(); | |
new Tree(10.0); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment