Question: Sky2.java Lastly, implement Sky in a different way. When one class holds many references to instances of another class, we say (for example) that

Sky2.java Lastly, implement Sky in a different way. When one class holds

Sky2.java Lastly, implement Sky in a 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 . 1. What is the parent class of Sky2? 2. What does Sky2 inherit from its parent class? Create class Sky2 in the weather. The Sky2 constructor will need to explicitly call the correct superclass constructor, 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(). Hint. Sky2 is an ArrayList. What about adding clouds to Sky2? 1) First copy add() from Sky and modify it so it adds clouds correctly. 2) There is a simpler way. Can you figure it out? Copy in the main() method from the Sky class. What do you need to change to create instances of Sky2? To test Sky2, run it as an application.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!