-name: string -author: Author -price: double Book +Book(name: string, author: Author, price: double) +getName(): string +getAuthhor(): Author +getPrice(): double +setPrice(price: double): void +print(): string The class Book contains: • Three private member variables: name (String), 0 O . author (an instance of the Author class we have just created, assume b has exactly one author). 0 price (double). The public getters and setters: getName().getAuthor (), getPrice (). set Price (). A print () that returns "book-name by author-name (gender) at email". could reuse the Author's print () function, which returns "author-name (gen mail"

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Write a program to test the Book class using C++. Create objects and use the print function in the objects to display information.

-name: string
-author: Author
-price: double
Book
+Book(name: string, author: Author, price: double)
+getName(): string
+getAuthhor(): Author
+getPrice(): double
+setPrice (price: double): void
+print(): string
The class Book contains:
Three private member variables:
0
name (String),
0
author (an instance of the Author class we have just created, assume book
has exactly one author),
0 price (double).
The public getters and setters: getName().getAuthor ().getPrice ().
set Price ().
A print () that returns "book-name by author-name (gender) at email". You
could reuse the Author's print () function, which returns "author-name (gender)
at email".
Transcribed Image Text:-name: string -author: Author -price: double Book +Book(name: string, author: Author, price: double) +getName(): string +getAuthhor(): Author +getPrice(): double +setPrice (price: double): void +print(): string The class Book contains: Three private member variables: 0 name (String), 0 author (an instance of the Author class we have just created, assume book has exactly one author), 0 price (double). The public getters and setters: getName().getAuthor ().getPrice (). set Price (). A print () that returns "book-name by author-name (gender) at email". You could reuse the Author's print () function, which returns "author-name (gender) at email".
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning