Solved by Expert Tutors
Solved by Expert Tutors
Question

Imagine a publishing company that markets both book and audiocassette versions of its work. Make a class

Publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: Book which adds page count (type int) and author (a string); and Tape which adds a playing time in minutes (type float). Each of these three classes should have a getData() function to get its data from the user at keyboard, and a putData() function to display its data.

Add a member function having return type bool called is Oversize() to the book and tape classes. Let's say that a book with more than eight hundred pages, or a tape with a playing time longer than 90 minutes (which would require two cassettes), is considered oversize. You can access this function from main() and display the string "Oversize" for oversize books and tapes when you display their other data. If book and tape objects are to be accessed using pointers to them that are stored in an array of type publication, what do you need to add to the publication base class? Can you instantiate members of this base class?

A main() program test the Book and Tape classes by creating instances of them, asking the user to fill in data with getData() and then displaying the data with putData(). The getData() and putData()of Publication should have protected access specifier. Mention proper accessor and mutator as well. You have to overload the + operator to find out the total price of 4 books and 6 tapes.

Step-by-step answer

The student who asked this found it Helpful

, dictum vitae odi


sum dolor sit amet,


a. Fusce dui lectus

consectetur adipis

Donec al

ur laoreet. Nam

e vel laoreet a

m ipsum dolor sit amet, c

risus ante, dapibus a mol



u






facilisis. Pellentesque dapibus efficitur la

Fusce dui lectus, congue vel laoreet ac, di

cing elit. Nam lacinia pulvinar

tesque

ipsum dolor sit am

a. Fusce dui lectu


a mole

sus ante, dapib

rem ipsum dolo

rem ipsum dolo

or nec facilisis. Pellentesque dap

u


cing elit. Nam lacinia

ipsum dolor sit amet,

sum dolor sit amet,

s ante, dapibus a

o


ac, dictum vitae odio

ia pulvinar tortor nec facilisis. Pellentesque

acinia pulvinar

sus ante, dapibus a molestie consequat, ultrices

llentesque dapi

ce dui lectus, congue vel laoreet ac, dictum

dictum vitae od


e vel laoreet ac, dictum vitae odio. Donec al

acinia pulvi

o

onec aliquet. Lorem i

gue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor

Fusce dui lectus, congue vel laoreet

at, ultrices ac magna. Fusce dui lec

, consectetur adipiscing elit. Nam lacinia

ce dui lectus, congue vel laoreet a

ipiscing elit.

m ipsum dolor sit amet, consectetur a

o


o



ec aliquet.

a molestie consequat, ultrices

tesque

itur laoreet. Nam risu

a mole

sus ante, dapib

rem ipsum dolo

rem ipsum dolo

sum dolor sit amet, consectetur a

u


s a molestie consequat

ec facilisis. Pellente

sum dolor sit amet,

s ante, dapibus a

o


ultrices ac magna. F

congue vel laoreet ac, dictum vitae odio. Don

acinia pulvinar

at, ultrices ac magna. Fusce dui lectus, congue

llentesque dapi

ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia

et, consectetur a


o

et, consectetur adipi

nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante,

ctum vitae odio. Donec aliquet. Lorem

ce dui lectus, congue vel laoreet ac

s a molestie consequat, ultrices ac magna. Fus

ipiscing elit.

onec aliquet. Lorem ipsum dolor sit a

o


o


, consectetur adipiscing elit. Nam

acinia pulvinar

at, ultrices ac magna. Fusce dui lectus, congu

risus ante, dapibu

o


ur laoreet. Nam risus ante, dapibus

or nec facilisis

Fusce dui lectus, congue vel laoreet ac, dictum vi

Donec aliquet. Lo

o


Fusce dui

e vel laoreet ac, dictum vitae od

fficitur laoreet.

ia pulvinar tortor n


s ante, dapibus a

ec aliquet. Lorem ip


lestie consequat, ultrices ac

rem ipsum

m ipsum dolor sit amet, consectetur adipiscing elit. Nam lacini

onec aliquet



tesque dapibus efficitur

s a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae

usce dui lectu

entesque dapibu


ipsum dolor sit amet, consectetur

ongue vel laoreet ac, dictum vitae

onec aliquet. Lorem


ec f

nec facilisis. Pelle

cing elit. Nam lacinia pulvinar tortor

icitur laoreet. Nam risus ante, dapibu

acinia pulvinar tortor n

ec aliquet. Lorem

ur laoree

ec aliquet. Lorem ipsum dolor sit amet, consectetur

gue vel laoreet

ec f



o


trices ac magna. Fusce dui lectus, congue vel laoreet


entesque dapibus efficitur la

a. Fusce dui lec

o


, consectetur adipiscing elit

facilisis. Pell

o

gue vel laore

cing elit. N

ec aliquet. Lorem ipsum

acinia pulvi
  • ac, dictum vitae odio. Donec alique
  • e vel laoreet ac, d
  • bookTape.jpg

bookTape.jpg
ipsum dolor sit amet, consectetur adipiscing elit sum dolor sit amet, consectetur adipis ng elit. Nam lacinia pulvinar tortor nec facilisis. Donec aliquet. Lorem ipsum dolor sit amet, consectetur a

Subscribe to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 C++ Programming tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes