CS 280 Recitation Assignment 9

$35.00 $29.00

A Publishing House publishes stories in three categories and has strict requirements for page counts in each one. Create an abstract class called Story, which has the following data members: story title (title), author name (author), number of pages (pages), type of story book (type), and a string message (msg). Include get and set member…

Rate this product

You’ll get a: zip file solution

 

Description

Rate this product

A Publishing House publishes stories in three categories and has strict requirements for page counts in each one. Create an abstract class called Story, which has the following data members: story title (title), author name (author), number of pages (pages), type of story book (type), and a string message (msg). Include get and set member functions for each field. Follow the naming convention for the setter and getter functions for each data member, such as setTilte(), getTitle(), etc. The Story abstract class has a constructor that accepts the type of story book as a parameter to initialize its type field. The type of story books considered are Novel, Novella and Short Story. The function that sets the number of pages (setPages()) is abstract. The setPages() function accepts one parameter for the number of words per page.

Create three Story subclasses called Novel, Novella, and ShortStory. The three child classes represent three types of stories, each with a specific page requirement. Each subclass has extra data members as constants for the page lower and upper limits in that category, and an extra data member for the number of words in the book. For the Novel subclass, the lower limit of pages is

  1. For the Novella subclass, the lower limit is 51 pages and the upper limit is 100. For the ShortStory, the lower limit is 5 and the upper limit is 50 pages. Include a constructor for each subclass that may be passed two parameters for initializing the number of words in the book and the type of story book; and include get and set member functions for the subclass data member. The setPages() member function should compute the possible number of pages in the book based on the number of words and the number of words per page passed as a parameter. The function should check whether the candidate book needs to be cut by a certain number of pages, or added certain number of pages to qualify for the type of story requirement. Otherwise, the book would be accepted. Accordingly, the function sets the msg data member with the required message to be used for display. See the example below for the format and contents of the messages.

Implement each class in a separate header file that carries the class’s name, such as: “Story.h”, “Novel.h”, etc.

Vocareum Automatic Grading

  • Upload your class implementation files to Vocareum.

  • The driver program “RA9prog.cpp” will be used to test your implementations. The program reads book information from a file and displays the list of candidate books along with possible messages to adjust the book to the book category requirement. An example of the expected output is shown below.

List of candidate story books to be published:

  1. Title: Goodbye Columbus Author: Philip Roth Pages: 47

Story Category: Novella

Pages must be added to the book to satisfy the requirements of a Novella: 4

  1. Title: The Pit and the Pendulum

Author: Edgar Allan Poe

Pages: 31

Story Category: Short Story

Book is accepted.

. . . .

  1. Title: Of Mice and Men Author: John Steinbeck Pages: 107

Story Category: Novella

Pages must be cut from the book to satisfy the requirements of a Novella: 7

  1. Title: Breakfast at Tiffany’s

Author: Truman Capote

Pages: 120

Story Category: Novel

Book is accepted.

. . . .

Submission Guidelines

  • Please upload your implementations to Vocareum in separate files one for each class, such as: “Story.h”, “Novel.h”, etc.

Grading Table

Item

Compiles Successfully

Implementation of Classes

Points

1

4

Total

5

CS 280 Recitation Assignment 9
$35.00 $29.00