Question: You are to refactor the following classes. Read through all of the classes provided below and decide which ones are similar enough that they would

You are to refactor the following classes. 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 "IS-A" 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 complications. 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 Refactoring.docx

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

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!