Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Enclose all your source code within the seneca namespace and include the necessary guards in each header fi . Books.txt ( # Author, Title, Country,

Enclose all your source code within the seneca namespace and include the necessary guards in each header fi. Books.txt(# Author, Title, Country, Price, Year, Summary
#-----------------------------------------------------------
Miguel de Cervantes, Don Quixote, Spain, 9.99,1612, The story follows a Hidalgo, Alonso Quixano, who proves that chivalry will in fact never die.
Charles Dickens, A Tale of Two Cities, UK,12.32,1859, A historical novel, set in London and Paris at teh begiming and during the French Revolution.
George R.R. Martin, A Song of Ice and Fire, US,99.9,1997, Nine noble famillies begim fighting for control over teh mythical lands of Westeros.
J.R.R. Tolkien, The Lord of the Rings , UK,21.11,1993, Sauron has gathered to him all teh Rings of Power, and he intends to use them to rule Middle-earth.
J.K. Rowling, Harry Potter, UK,45.99,1997, Harry realizes his life is far from ordinary.
Dan Brown, The Da Vinci Code, US,7.88,2003, While in Paris, Harvard symbologist Robert Langdon is awakened by a phone call in teh night.
J.D. Salinger, The Catcher in teh Rye , US,12.21,1951,The story of a teen named Holden Caulfield and his struggle to find his voice in an adult world.)movies.txt(# Author, Title, Country, Price, Year, Summary
#-----------------------------------------------------------
Miguel de Cervantes, Don Quixote, Spain, 9.99,1612, The story follows a Hidalgo, Alonso Quixano, who proves that chivalry will in fact never die.
Charles Dickens, A Tale of Two Cities, UK,12.32,1859, A historical novel, set in London and Paris at teh begiming and during the French Revolution.
George R.R. Martin, A Song of Ice and Fire, US,99.9,1997, Nine noble famillies begim fighting for control over teh mythical lands of Westeros.
J.R.R. Tolkien, The Lord of the Rings , UK,21.11,1993, Sauron has gathered to him all teh Rings of Power, and he intends to use them to rule Middle-earth.
J.K. Rowling, Harry Potter, UK,45.99,1997, Harry realizes his life is far from ordinary.
Dan Brown, The Da Vinci Code, US,7.88,2003, While in Paris, Harvard symbologist Robert Langdon is awakened by a phone call in teh night.
J.D. Salinger, The Catcher in teh Rye , US,12.21,1951,The story of a teen named Holden Caulfield and his struggle to find his voice in an adult world.)w5_p2.cpp(#include
#include
#include
#include "Collection.h"
#include "Collection.h"// intentional
#include "SpellChecker.h"
#include "SpellChecker.h"// intentional
#include "Book.h"
#include "Book.h"// intentional
#include "Movie.h"
#include "Movie.h"// intentional
int cout =0; // won't compile if headers don't follow convention regarding namespaces
enum AppErrors
{
CannotOpenFile =1,// An input file cannot be opened
BadArgumentCount =2,// The application didn't receive anough parameters
};
// The observer function for adding books to the collection:
// should be called every time a new book is added to the collection
void bookAddedObserver(const seneca::Collection& theCollection,
const seneca::Book& theBook)
{
std::cout << "Book \""<< theBook.title()<<"\" added!
";
}
// The observer function for adding movies to the collection:
// should be called every time a new movie is added to the collection
void movieAddedObserver(const seneca::Collection& theCollection,
const seneca::Movie& theMovie)
{
std::cout << "Movie \""<< theMovie.title()
<<"\" added to collection \""<< theCollection.name()
<<"\"("<< theCollection.size()<<" items).
";
}
// ws books.txt movies.txt file_missing.txt file_words.txt
int main(int argc, char** argv)
{
std::cout << "Command Line:
";
std::cout <<"--------------------------
";
for (int i =0; i < argc; ++i)
std::cout << std::setw(3)<< i +1<<": "<< argv[i]<<'
';
std::cout <<"--------------------------
";
// get the books
seneca::Collection library("Bestsellers");
if (argc ==5){
// TODO: load the first 4 books from the file "argv[1]".
//- read one line at a time, and pass it to the Book constructor
//- store each book read into the collection "library" (use the += operator)
//- lines that start with "#" are considered comments and should be ignored
//- if the file cannot be open, print a message to standard error console and
// exit from application with error code "AppErrors::CannotOpenFile"
/*
Hey, I just met you,
And this is crazy,
But here's my number. (register the observer)
So, if something happens, (event)
Call me, maybe? (callback)
/
library.setObserver(bookAddedObserv)I need you to make the program, include all code and output matches

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

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

Students also viewed these Databases questions