Question
Solve this in C++ asap! BookTester.cpp is given and cannot be modified. Require Book.h Book.cpp Chapter.hChapter.cpp BookTester.cpp #include#include#includeChapter.h#includeBook.husing namespace std;using namespace sdds; void displayBooks(const Book*
Solve this in C++ asap! BookTester.cpp is given and cannot be modified. Require Book.h Book.cpp Chapter.hChapter.cpp
BookTester.cpp
#include#include#include"Chapter.h"#include"Book.h"using namespace std;using namespace sdds;
void displayBooks(const Book* b, int num);void DMAtest(Book& B);int main() {
Chapter cp1[] = { Chapter("C++",75), Chapter("Java",60), Chapter("JavaScript",80) , Chapter() };
Chapter cp2[] = { Chapter("C++",75), Chapter("Java",60), Chapter("JavaScript",80), Chapter("",100) };
Chapter cp3[] = { Chapter("C++",75), Chapter("Java",60), Chapter("JavaScript",80), Chapter("Bad1", 0) };
Chapter cp4[] = { Chapter("C++",75), Chapter("Java",60), Chapter("JavaScript",80), Chapter(nullptr, 40) }; Chapter cp[] = { Chapter("C++",75), Chapter("Java",60), Chapter("JavaScript",80) };
Book bo[] = { Book(nullptr,3,cp), Book("Bad1", 0,cp), Book("Bad2", 4,cp1), Book("Bad3", 4,cp2), Book("Bad4", 4,cp3), Book("Bad5", 4,cp4), Book("Object Oriented Programming Languages",3, cp) };
cout << "Displaying invalid Book objects"<< endl; cout <<"-------------------------------------------------------" <
The output of this assignment
Chapter A Chapter object should get instantiated using the name of the Chapter and the number of pages. The name can be a maximum of 50 characters long and the pages of the chapters cannot be more than 200. If any of this information is not provided or if they are invalid, the object is created in an invalid state. A Chapter is displayed as follows (if Valid): Name in 50 spaces, filled with dots !!, left-justified Number of pages in 3 spaces right-justified Newline If the chapter is invalid, it should just print: "invalid Chapter" and go to newline. For example if the Chapter name is Java and it is 60 pages, it should print as follows: Java... Book 60 A Book is created using its name, number of chapters and an array of Chapters (with "number of chapters" elements). The length of the name or the number of chapters is unknown. The following are the public functions required for the Class Book. bool isEmpty() const; returns true if the Book is empty or invalid, otherwise, it returns false;
Step by Step Solution
3.49 Rating (159 Votes )
There are 3 Steps involved in it
Step: 1
Based on the code snippet requirements and the output provided you need to implement two classes Chapter and Book along with their respective methods as described Here are the class definitions and me...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