Question: Hey guys! Can you please help me with this coding assignment? Here are the directions: Sky2.java Lastly, implement Sky in a somewhat different way. When
Hey guys! Can you please help me with this coding assignment?
Here are the directions:
Sky2.java
Lastly, implement Sky in a somewhat different way. When one class holds many references to instances of another class, we say (for example) that Sky aggregates clouds. Sky aggregates by owning an array list. Sky2 will aggregate by being (in a sense) an array list. That is, Sky2 will extend ArrayList
Create class Sky2 in the weather. The Sky2 ctor will need to explicitly call the correct superclass ctor, so that the initial capacity is 100.
Copy getMeanHeight() from Sky. You need to change it so that it traverses the correct list of clouds, which is the instance of Sky2 that is executing getMeanHeight(). Huge hint: its name is this.
What about adding clouds to Sky2? You could just copy add() from Sky and then make a simple change. But there is an even simpler way.
Paste in the main() method from the Sky class. Change the line Sky sky = new Sky() to Sky2 sky = new Sky2() To test Sky2, run it as an application."
I already wrote the Sky class and here it is:


Here is what I've attempted on my Sky2 class:


Here is the error I get when I run the Sky2 class:

Any help is appreciated!
package weather; import java.util.ArrayList; public class Sky //declare an array list private ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
