Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program definition: Design a class bookType that defines a book as a class. Each object of the class bookType will hold the following information about

Program definition:

Design a class bookType that defines a book as a class.

  1. Each object of the class bookType will hold the following information about a book:

title

number of authors

up to four authors

publisher

year published

ISBN 13 (with dashes)

price

number of copies in stock (may be 0)

  1. Include the member functions to perform the various operations on objects of type bookType: get and set all member variables.
  2. Add a member function to update the number of copies in stock.
  3. Add the appropriate constructors and a destructor (if one is needed). Ensure a default constructor is coded and the constructor initializes all data members. Remember, an array of classes uses a default constructor only.
  4. ALL member variables must be private and accessed through member functions. The main client program CANNOT access the variables directly.
  5. Ensure the class declaration and class implementation files are in separate header and code (.cpp) files. This assignment will require the creation of a project.
  6. Write a client program that uses the class bookType and tests various operations on the objects of the class bookType. Declare an array of 100 components of type bookType in the client program.
  7. Using a function, open the attached datafile (bookData.txt). Request the file name from the user. If the file does not open, display a proper message and exit the program. The file open should be in main and test a return value of success or failure.
  8. Use a function and the attached datafile (bookData.txt) to initially load the data. The data file is of the form:

Book Title

ISBN

Publisher

Year Published

Cost

Number In Stock

Number of Authors

List of Authors

  1. Read until end of file. Do not hardcode and use the actual number of books as the maximum (limiting factor) for the array of books. Keep a count of actual rows read and pass into and out of any functions and processes.
  2. Have the program provide the following capabilities (by user request):

Through a menu system provide the capability to:

  1. Search for a book by ISBN, Author or Book title. If the store sells the book, return an appropriate message. If the store does not sell the book, return an appropriate message. If the store sells the book, print the Title, authors, ISBN, publisher, price and the number in stock for the book.
  2. Print a list of ALL the books in stock. This list will include all the information available for a book. A book is in stock when the number in stock is greater than 0.
  3. Update the number of copies in stock. The user may search for the book using one of the capabilities indicated in (1) (by ISBN, Author or Title) and add to the number of copies by the number entered. This will simulate the process of restocking.
  4. Print a list of ALL the books the store sells, even if not in stock at the time. The list will include all the information available for a book.
  5. The user may exit the program by keying in an exit command or choice determined by you.
  6. Place all function prototypes and const variables for the client program in a header file. Include the header file in the client program.
  7. Include error checking (invalid choices, file open errors, etc.)

Once your class is declared and defined and your client program written, test each of the menu options to ensure proper processing and program behavior.

All classes must have a class definition header file (*.h) and a class implementation file (*.cpp). You must have a main program that exercises these classes (*.cpp).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

Students also viewed these Databases questions

Question

8-6 Who poses the biggest security threat: insiders or outsiders?

Answered: 1 week ago