Question
Include 3 SEPERATE .cpp files: main.cpp, publication.cpp, library.cpp Write in C++ an application that manages these publications as objects. We'll want to know the title,
Include 3 SEPERATE .cpp files: main.cpp, publication.cpp, library.cpp
Write in C++ an application that manages these publications as objects.
We'll want to know the title, author, copyright year, genre, media, target age, and ISBN for each of our publications. We'll also want to know if the publication is checked in or checked out to a customer, and if checked out to a customer, who that customer is (their name and telephone number). It's ok to to enter the customer information each time a publication is checked out,
Each publication object should be able to print its contents and its check out status something like this:
The Firm by Bob Willis, 1991 (adult fiction book) ISBN: 0440245923 Checked out to Jeremy Lin (817-272-3785)
This is a suggested menu for the Librarian to use
------------
(1) Add publication
(2) List all publications
(3) Check out publication
(4) Check in publication
-----------
(9) Help
(0) Exit
The types Genre, Media, and Age can be implements in two ways:
Option 1: They are well-suited to be enums, with the enumerated values given in the requirements: The library consists of a lot of publications in several types of media books, periodicals (also called magazines), newspapers, audio, and video. Each publication falls into a particular genre fiction, non-fiction, self-help, or performance and target age children, teen, adult, or restricted (which means adult only). The problem with enums is that it's obviously unacceptable to print age 3 or media 5 when printing out a publication you'll need some way to convert a value back to a string.
Implement a (possibly private) method of Publication to convert the resulting int back into a string for Publication::to_string. Calling these methods "genre_to_string" et. al. may offer a certain consistency, e.g., string genre_to_string(Genre genre);.
Implement a helper function of the same name that exists in global space.
Use a vector of strings, e.g., given enum Color {red, green, blue}; vector color_to_string = {red, green, blue};, you could convert a Color variable to a string using, e.g., Color color = Color::red; cout
OPTION 2: : Or, you can make them each a class with an intrinsic to_string method of their own (called from the publication's to_string method).
ra publications:vector Publication> + add publication(pub: Publication) + check out(publication index: int, patron_name: string, patron_phone: string) + check in publication index: int) main rar - library + maino: int +show menu() + list publications() + execute cmd(cmd: int) library+publication to string(publication index: int): string + number of publications(): int Publication title: string -author: string - copyright: string genre:Genre -media: Media -target age: Age -isbn:string -checked out: bool -patron_name: string - patron phone: stri +Publication(title:string, author : string, copyright: string, genre: Genre, media: Media, target age :Age, isbn:string + check out(patron_name: string, patron _phone : string) + check in() + is checked out(): bool +to string): striStep 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