Question
What is the difference between coding 10 rocks to a world and then creating a method to add 10 leaves to the world. Going off
What is the difference between coding 10 rocks to a world and then creating a method to add 10 leaves to the world. Going off of that how would I change it to where when the code is reset there location is random each time?
I have my rocks coded so far as
Rock rock = new Rock();
addObject(rock, 3, 6);
Rock rock2 = new Rock();
addObject(rock2, 1, 1);
Rock rock3 = new Rock();
addObject(rock3, 9, 2);
Rock rock4 = new Rock();
addObject(rock4, 8, 8);
Rock rock5 = new Rock();
addObject(rock5, 4, 2);
Rock rock6 = new Rock();
addObject(rock6, 8, 0);
Rock rock7 = new Rock();
addObject(rock7, 0, 7);
Rock rock8 = new Rock();
addObject(rock8, 2, 3);
Rock rock9 = new Rock();
addObject(rock9, 6, 6);
Rock rock10 = new Rock();
addObject(rock10, 7, 2);
but Im being told to add the leafs differently i've been trying
Leaf leaf = new Leaf();
addLeaf(10);
but I keep getting error in my code.
I'm stuck and any help would be great.
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