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 TextBook

ID: 3702321 • Letter: C

Question

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

Create a class TextBook with the data members listed below. Include a default constructor, a constructor with parameters for each data member, and "Get " and "Set " access method for each data member. For example if a class had a data member named mydata, the class would require methods named: getMydata and sethiydata. You must also provide the float CostPerPage0 method for the class to calculate the average cost of a book page (based on cost divided by pages) Question 5 Not answered title. which is a string (initialize to empty string) pages, which is an integer value (initialize to 0) cost, which is a floating point value (initialize to 0.0) online, which is a Boolean value (initialize to false) Mark 0.00 out of 10.00 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 "private" for class dota types and methods. Include public or private explicity Answer (penalty regime 0%)

Explanation / Answer

class TextBook { private: string title; int pages; float cost; bool online; public: TextBook(); TextBook(string t, int p, float c, bool o); void setTitle(string t); void setPages(int u); void setCost(float s); void setOnline(bool o); string getTitle(); int getPages(); float getCost(); bool getOnline(); float CostPerPage(); }; TextBook::TextBook() { title = ""; pages = 0; cost = 0.0; online = false; } TextBook::TextBook(string t, int p, float c, bool o) { title = t; pages = p; cost = c; online = o; } void TextBook::setTitle(string t) { title = t; } void TextBook::setPages(int p) { pages = p; } void TextBook::setCost(float c) { cost = c; } void TextBook::setOnline(bool o) { online = o; } string TextBook::getTitle() { return title; } int TextBook::getPages() { return pages; } float TextBook::getCost() { return cost; } bool TextBook::getOnline() { return online; } float TextBook::CostPerPage() { return cost / pages; }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote