Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (50 points) Develop two classes. TropicalStorm which is a subclass of Storm and Hurricane as a subclass of TropicalStorm. The class TropicalStorm defines these
1. (50 points) Develop two classes. TropicalStorm which is a subclass of Storm and
Hurricane as a subclass of TropicalStorm.
The class TropicalStorm defines these methods:
a. An overloaded constructor init () which takes all the properties of a TropicalStorm in addition to a name of the storm.
b. getName retrieves the name of the storm
c. setName sets the name of the storm The class Hurricane defines two methods:
a. An overloaded constructor init () that takes the hurricanes category in addition to all the other properties of Storm and TropicalStorm. It should set the category of the Hurricane (0-5), which is an instance variable in the Hurricane class, to the specified parameter but should call the constructor for the TropicalStorm class to set the other attributes. If category is less than 0 the category is 0 and if it is greater than 5 then it should be set to 5. Default is 0.
b. getCategory() which returns the category of the Hurricane.
c. setCategory() which sets the category of the Hurricane.
The following shows how the Storm, TropicalStorm and Hurricane classes and methods could be used:
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