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

Serendipity Booksellers Software DevelopmentProject— Part 13: A Problem-Solving

ID: 3819740 • Letter: S

Question

Serendipity Booksellers Software DevelopmentProject— Part 13: A Problem-Solving Exercise
1. Convert the BookData Structure to a Class.

The program currently keeps data about books in a structure called BookData.Convert the structure declaration to a class declaration. The existing membervariables should be made private.
2. Convert Functions to Member Functions.
In Chapter 11 you created the following functions for directly accessing ormanipulating the member variables of the BookData structure:

setTitlesetISBNsetAuthorsetPubsetDateAddedsetQtysetWholesalesetRetailisEmptyremoveBook

Because the structure is now a class, and the member variables are private, youwill need to convert these functions to member functions of the BookDataclass.

How would I go about doing this?

Explanation / Answer

Simply create class instead on structure like

class BookData
{

private:

// declare private members here
   string isbn, title, author, date;
   int qty;
   float wholesale, retail;
   
   public:
   // declare all your member functions here as
   void setISBN(string s)
   {
isbn=s;
}   
// similarly you can define as many functions as you ant

};

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