Question: Ski Class Description o Class that represents a generic type of ski. o Superclass in hierarchy. Private Data Fields o type - String representing the

Ski Class
Description
o Class that represents a generic type of ski.
o Superclass in hierarchy.
Private Data Fields
o type - String representing the type of ski (cross-country, etc.) will contain no spaces
o brand - String representing the skis brand - may contain spaces
Public Methods
o Constructor: public Ski(String type, String brand)
Creates a ski using the incoming values for type and brand
o Getters
One for each private data field - type, brand
o Setters
No setters are needed (this is being done on purpose so do not include setters)
o public String description()
Returns a string that describes the ski.
CrossCountry, Downhill, Snowboard Subclasses
Description
o Each class represents a specific ski.
o Each of these classes must be a subclass of Ski.
Private Data Fields
o None
Public Methods
o Each subclass must have a constructor that:
Creates a specific Ski with a specific type and brand.
Note that type is not sent to the constructor - brand is the only incoming value.
public CrossCountry(String brand){}
Why is type not sent to constructor?
Inside each constructor the type of ski is known, so there is no need to
send the constructor the type.
For example, in the CrossCountry constructor, we know the type of ski
being created is a CrossCountry ski so the type CrossCountry does not
need to be passed into the constructor, instead the string
CrossCountry can be sent to the superclass constructor along with the
brand.
o Each subclass must override the description() method in the Ski class.
@Override
public String description()
Use the following descriptions for each specific ski:
Ski Type Description
cross country Long & thin skis with binding that allows heal to be free
downhill All-mountain skis where width depends on skill level
snowboard Single board where both feet are secured onto board in two bindings
SkiShop

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 Databases Questions!