Question: You are to create a program that can be used for keeping track of textbooks required and recommended for classes and the cost of those
You are to create a program that can be used for keeping track of textbooks required and recommended for classes and the cost of those textbooks.
All input will be taken from standard input. Each line of input will begin with a single or double character code that identifies the type of operation that line describes. The possible line formats are:
B
- Define a book. The ISBN is a 13 digit number. The Title is a string of arbitrary length (ending
with a line break).
e.g.: B 1234567890123 Programming for Programmers
Define a characteristic of a book (for the book with the given ISBN. If 'A' is used, then the Author is set, and the value is name of the author (string of arbitrary length, ending with end of line). If 'E' is used, the value is the number of the edition (a positive integer). If D is used, it is the date of publication, where the date is in MM/YYTV format (no day). e.g.: D 1234567890123 D 01/2017
M
Define the cost for a book. ISBN is the ISBN number, Cost is an amount, expressed as a floating-point number with 2 spaces after the decimal point. The final letter indicates whether the price is for a New, Used, Rented, or Electronic version of the book. A book may have a different price for each format.
e.g.: M 1234567890123 39.99 N
C
- Define a course. The Department Code is a 4 letter code for a department. The course number is a 3-digit number for the course. The name is a name for the course a string of arbitrary length, ended by the end of the line.
e.g.: C CSCE 315 Programming Studio
A
Assign a book to a class. The ISBN is the ISBN number for the book. The Department Code and Course number are as in the definition of a course. The section number is a 3 digit integer. The final digit is either R for required or 0 for optional.
e.g.: A 1234567890123 CSCE 315 501 R
GC
-Print the books required and optional for all sections of a given course
GS
-Print the books required and optional for a given section of a course
GB
-Print all information known about a particular book
PB
-Print a list of all books that are defined
PC
-Print a list of all courses that are defined
PY
- Print all books with known publication dates in the given month/year or later.
PD
- Print the list of all books used in a department, given by department code. Do not list by section.
PM
Print the AVERAGE minimum and maximum costs of all books in a department. Minimum cost is
the cost of the cheapest version of required books for a section. Maximum cost is the cost of
the most expensive required and optional books in a course. If a book has no known costs,
ignore it. The average is the average across all sections in a department for which there is some
required or optional book.
Notes:
The program should be developed in C++
-Books will be defined before details or costs are added
-Books and courses will be defined before books are added to courses.
-Note that later lines can overwrite information from previous lines. For example, a price could
be updated, an edition number could change, etc. The last of the input lines should be the one
used.
-Printed lists should be reasonably informative, with all information provided possible (e.g. when
printing a book, print the title, author (if known), costs (if known), etc.
----------------------------------------------------------------------------------------------------------------------------------------------
TEST inputs below can be used to test the programs functionality(Note: this stuff needs to be in a test.txt file and possible run a command such "./main < test.txt" but you can test it your way to.) :
TEST data that can be used to test each of the input formats:
B 1234567890123 Programming for Pros B 1234567890124 Programming for Dummies B 1234567890125 Programming for Pets D 1234567890123 D 02/2017 D 1234567890123 A King of Stupid D 1234567890123 E 5 D 1234567890124 D 05/2017 D 1234567890124 A Ray D 1234567890124 E 2 D 1234567890125 D 03/2017 D 1234567890125 A James D 1234567890125 E 3 M 1234567890123 1 N M 1234567890123 1 U M 1234567890123 1 R M 1234567890123 1 E M 1234567890124 1 N M 1234567890124 1 U M 1234567890124 1 E M 1234567890124 1 R M 1234567890125 1 N M 1234567890125 1 U M 1234567890125 1 R M 1234567890125 1 E C ECEC 215 Programming Studio C ECEC 111 Unix Testing A 1234567890123 ECEC 215 501 R A 1234567890123 ECEC 215 502 R A 1234567890123 ECEC 215 503 R A 1234567890124 ECEC 213 604 R A 1234567890124 ECEC 213 607 R A 1234567890124 ECEC 213 603 R A 1234567890125 ECEC 215 501 R A 1234567890125 ECEC 215 502 R A 1234567890125 ECEC 215 503 R GC ECEC 215 GS ECEC 215 504 GC ECEC 111 GS ECEC 111 605 GB 1234567890123 GB 1234567890124 GB 1234567890125 PB PC PY 02/2017 PY 05/2017 PD ECEC PM ECEC
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
