Question: Write a Sweatshirt class with attributes for: the size (example values could be: S, M, L, XL, 8X, etc.) whether or not the Sweatshirt has

Write a Sweatshirt class with attributes for: the size (example values could be: S, M, L, XL, 8X, etc.) whether or not the Sweatshirt has a hood

Don't forget that if the constructor in your Clothing class has parameters, that your Sweatshirt class constructor must pass values to it.

Next, you'll want to override the toString from the Clothing class to return Sweatshirt specific information as well when the object is printed. Here's an example:

XL hooded stargate hoodie, blue $16.88 XXXL Clayton State sweatshirt, orange $ 9.99

The first sweatshirt had a hood, the second one did not. You can use a simple if statement in your toString to determine how you'd like that to be displayed.

In your driver, create a 2 Sweatshirt objects, one with a hood and one without, then print them.

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!