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
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