Question
Instructions Read through all of the classes provided below and decide which ones are similar enough that they would belong in the same class hierarchies.
Instructions
Read through all of the classes provided below and decide which ones are similar enough that they would belong in the same class hierarchies. Then find a meaningful way to build the hierarchies keeping in mind the following concepts:
- Subclasses should always possess the "ISA" relationship with the corresponding superclass.
- All commonality should be placed as high in the hierarchy as possible.
- Although full OO classes will have behaviors, some of the classes provided below do not have any to reduce complication. Do not add behaviors (or any additional attributes) to these classes.
- You should add superclasses as needed. If one class inherits from another, clearly indicate the class that is being inherited from and clearly indicate which attributes and behaviors are being inherited and which are not.
Create a Word document for your refactored classes titled Lab2a_yourlastname.docx. Once you have completed the lab, upload this file to Canvas.
Classes to refactor:
Class name: Student
Attributes | Behaviors |
age | sleep() |
address | attendClass() |
workEthic | study() |
major | party() |
Class name: Professor
Attributes | Behaviors |
age | sleep() |
address | attendClass() |
tenure | prepareForClass() |
degree | pontificate() |
Class name: DigitalMedia
Attributes |
title |
price |
format |
Class name: DVD
Attributes |
title |
price |
format |
numberOfBytes |
storageCapacity |
type |
layers |
Class name: eBook
Attributes |
title |
price |
format |
numberOfBytes |
numberOfChapters |
author |
Class name: youtubeVideo
Attributes |
title |
price |
format |
numberOfBytes |
resolution |
length |
Class name: Magazine
Attributes |
title |
price |
font |
numberOfPages |
editor |
frequencyOfPublication |
Class name: Book
Attributes |
title |
price |
font |
numberOfPages |
ISBN |
publisher |
Class name: Newspaper
Attributes |
title |
price |
font |
numberOfPages |
journalist |
sections |
Step by Step Solution
3.36 Rating (165 Votes )
There are 3 Steps involved in it
Step: 1
Sending you two code snippets The first one is the main code containing all the functions The se...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