Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions