Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Programming Assignment 2 Purpose: Demonstrate the use of classes Program definition: Design a class bookType that defines a book as a class. Each object of
Programming Assignment 2 Purpose: Demonstrate the use of classes 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 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) Include the member functions to perform the various operations, required in the below menu, on objects of type bookType: Include individual get and set functions for all member variables. 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. ALL member variables must be private and accessed through member functions. The main client program CANNOT access the variables directly. 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. 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. 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. 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 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. Have the program provide the following capabilities (by user request): Through a menu system provide the capability to: 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. 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. 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. 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. The user may exit the program by keying in an exit command or choice determined by you. Place all function prototypes and const variables for the client program in a header file, if appropriate. Include the header file in the client program. Include error checking (invalid menu 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). You must create a project in the IDE of your choice. You must submit all header files, source files (*.cpp) and the project file (*.dev; *.cbp). Submit a README file that contains: The names of all your files including all the files in the project; how to compile; and how to run. All assignments are to be submitted to the appropriate Assignment posting in Canvas. Submit your code files (*.cpp, *.h), and readme file. Program must compile and all files must be submitted to receive credit. DO NOT submit the executable (*.exe). A program that does not compile will receive a zero (0). You may zip all your files and submit the zip file. A zipped submission will receive 1 point extra credit. The code file must contain the following as documentation. If the following is not included, 10% may be deducted: The name of your C++ file Your name Some kind of date, either the due date or the date you finished The type of input The type of output A brief description of the algorithm or purpose of the program For example: / * Program name: assignment1.cpp Author: Pam Smith Date: 8/25/18 Input: requests an input and output file name from the user (inputfile.txt provided). Output is name of your choice Output: displays output on the console and writes output to file name provided Description: This program translates a word or phrase using the ROT13 cipher */ All procedures and functions should be documented with the following information: A brief description of the purpose of the function or procedure Signature : return type, name, parameters (including type) A list of the parameters and what each represents A description of the function return type as applicable Precondition(s) as applicable Postcondition(s) as applicable For example: /* myfunction outputs the values contained in the input parameters. myfunction returns no value; it takes an integer parameter as input and a character parameter as input The integer parameter contains the ordinal number representing a letter in the alphabet The character parameter contains a letter of the alphabet No value is returned Precondition: the integer value must contain a valid number representing the ordinal number of the letter contained in the character parameter; the character parameter must contain a value representing a letter of the alphabet Postcondition: there are no post conditions */ void myfunction (int a, char b) {}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started