Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

A Chapter object should get instantiated using the name of the Chapter and the number of pages

Computer Science Oct 10, 2021

A Chapter object should get instantiated using the name of the Chapter and the number of pages. The name can be 3 maximum of 50
characters long and the pages of the chapters cannot be more than 200. ff any of this information is not provided or if they are invalid, the
‘object is created in an invalid state.
A Chapter is displayed 3s fallows ( Valid:
© Name in SO spaces, filled with dots ‘., left-justified
© Number of pages in 3 spaces right justified
*°  Newine
tthe chapter is invalid, it should just print: “iawalid Qugtee” and go to newline.
For example if the Chapter name is Java and it is 60 pages, it should print as folows:
TVD. os ccescntccencctccmsccnsccnsesscctscnsccnss GF
Bock
A Book is crested using ts name, number of chapters and an array of Chapters ( with “number of chapters elements).
‘The length of the name ar the number of chapters is unknown.
‘The following are the publc functions required far the Class Book.
Bool istapty( jconst;
retums true if the Book is empty or invalid, otherwise, it returns false:
Goold addchaptar{canst char? chapter nase, int noGfPages};
Adds a Chapter to a Book only if the name and noOfPages are valid values (to create a Chapter with).
wold display()consts
Displays the Book as follows, if it is valict
© prints “Book Name: *
© prints the book name value
© NEWLINE
© prints “No of chapters: *
© prints the number of chapters
© prints all the Chapters in individual lines if the book is invalid it will print:
© othenwice, prints “Invaled book object’:

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment