Skip to content

Instantly share code, notes, and snippets.

@ksolo
Created August 12, 2013 12:39
Show Gist options
  • Save ksolo/6210494 to your computer and use it in GitHub Desktop.
Save ksolo/6210494 to your computer and use it in GitHub Desktop.
//////// Your Code ///////////////////////////////////////////////
/////// Driver Code /////////////////////////////////////////////
var tree = new OrangeTree();
while (!tree.hasOranges()) {
tree.incrementAge();
}
console.log("Tree is " + tree.age + " years old and " + tree.height/12 + " feet tall");
while(tree.isAlive()) {
var basket = [];
while(tree.hasOranges()) {
basket.push(tree.pickOrange());
}
var avgDiameter = function() {
// create this method
};
console.log("Year " + tree.age + " Report");
console.log("Tree height: " + tree.height + " feet");
console.log("Harvest: " + basket.length + " oranges with an average diameter of " + avgDiameter() + " inches");
console.log("");
tree.incrementAge();
}
console.log("Alas, the tree, she is dead!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment