Question: in c++ please code 1 Author -name: string - email:string -gender:char Book -name: string -author:Author -price: double -qtyInStock:int = 0 +Book(name:string, author:Author, price:double, qtyInStock:int) +getName():string

in c++ please codein c++ please code 1 Author -name: string - email:string -gender:char Book

1 Author -name: string - email:string -gender:char Book -name: string -author:Author -price: double -qtyInStock:int = 0 +Book(name:string, author:Author, price:double, qtyInStock:int) +getName():string +getAuthor(): Author +getPrice(): double +setPrice (price:double):void +getQtyInStock(): int setQtyInStock(qtyInStock:int):void +print():void +getAuthorName():string Design a Book class. Assume that a book is written by one and only one author. The Book class (as shown in the class diagram) contains the following members: 1. Four private data members: name (string), author (an instance of the class Author that we have created earlier), price (double), and qtyInStock (int, with default value of 0). The price shall be positive and the qtyInStock shall be zero or positive. 2. Take note that data member author is an instance (object) of the class Author, instead of a fundamental types (such as int, double). In fact, name is an object of the class string too. 3. The public getters and setters for the private data members. Take note that getAuthor( returns an object (an instance of class Author). 4. A public member function print, which prints "book-name' by author- name (gender) @ email". 5. A public member function getAuthorName, which returns the name of the author of this Book instance. 6. The hallow diamond shape in the class diagram denotes aggregation or has-a) association relationship. That is, a Book instance has one (and only one) Author instance as its component

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!