Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
This assignment is not for distribution online or by any other means. Copyright M. Gonzalez UCCS
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
Description

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

More Books

Students also viewed these Databases questions