Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microeconomics An Intuitive Approach with Calculus

Authors: Thomas Nechyba

1st edition

538453257, 978-0538453257

More Books

Students also viewed these Programming questions

Question

26. Name at least two ways a gene could influence alcoholism.

Answered: 1 week ago