Design a class bookType that defines a book as a class. a. 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)
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Design a class bookType that defines a book as a class.
a. 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)
b. Include the member functions to perform the various operations on objects of type bookType: Include individual get and set functions for all member variables.
c. Add a member function to update the number of copies in stock.
d. 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.
e. ALL member variables must be private and accessed through member functions. The main client program CANNOT access the variables directly.
f. 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.
g. Write a client program that uses the class bookType and tests various operations on the objects of the class bookType. Declare an array of 50 components of type bookType in the client program.
h. 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.
i.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
j.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.
k. 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.
l.Place all function prototypes and const variables for the client program in a different header file than the class header file. Include the header file in the client program.
m. Include error checking (invalid menu choices, file open errors, etc.)
n. 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). You must create a project in the IDE of your choice.
Please show the output of the program too
Thank you
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images