Answered step by step
Verified Expert Solution
Link Copied!

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:
image text in transcribed
>>>sl-TropicalStorm () >S1 Tropicalstorm(0, 0,1900, default) >>>s2-TropicalStorm (20,80,2007, Bob') >s2 TropicalStorm (20, 80 ,2007,Bob) >>S2.getName ) Bob' >>>s2.getYear () 2007 >>33-Hurricane () >>S3 Hurricane (, 0,1900, default,o) >>>print (s3) I am category 0 Hurricane named default. I have peak winds of 0 mph, peak rain fall of 0 inches per hour in the year 1900 >>> s4=Hurricane (12, 200, 2017,' Irma ' , 5) >>>34.getCategory () >>>4.getWindSpeed () 200 >>>print (s4) I am category 5 Hurricane named Irma. I have peak winds of 200 mph, peak rain f all of 12 inches per hour in the year 2017 >>>s5-TropicalStorm (20,20,2012, 'Tony') >>print (s5) I am Tropical Storm named Tony. I have peak winds of 20 mph, peak rain fall of 20 inches per hour in the year 2012

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_2

Step: 3

blur-text-image_3

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

Students also viewed these Databases questions

Question

3. Comment on how diversity and equality should be managed.

Answered: 1 week ago

Question

describe the legislation that addresses workplace equality

Answered: 1 week ago