Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Could you help me solve the qusetion? USing C++. Thanks! Create a class Book wit

ID: 3702320 • Letter: C

Question

Could you help me solve the qusetion? USing C++. Thanks!

Create a class Book with the data members listed below. Include a default constructor, a constructor with parameters for each data member, and getters and setters methods for each data member. For example if a class had a data member named mydata, the class would require methods named: getMydata and setMydata. You must also provide the fioat AvgCosto method for the class to calculate the average cost of the book (based on sales divided by units). Question 3 Not answered ttle. which is a string (initialize to empty string) Mark 0.00 out of 10.00 units. which is an integer value (initialize to 0) sales, which is a floating point value (initialize to 0.0) P Flag question Your second constructor should take all data member variables as input in the order they are specified above. You only need to write the class definition and any code that is required for that class. Place all code within the class definition. NOTE: you must not use the implicit privote" for class dato types and methods. Incilude public or private explicitly. Answer: (penalty regime:0 %)

Explanation / Answer

class Book { private: string title; int units; float sales; public: Book(); Book(string t, int u, float s); void setTitle(string t); void setUnits(int u); void setSales(float s); string getTitle(); int getUnits(); float getSales(); float AvgCost(); }; Book::Book() { } Book::Book(string t, int u, float s) { title = t; units = u; sales = s; } void Book::setTitle(string t) { title = t; } void Book::setUnits(int u) { units = u; } void Book::setSales(float s) { sales = s; } string Book::getTitle() { return title; } int Book::getUnits() { return units; } float Book::getSales() { return sales; } float Book::AvgCost() { return sales / units; }