CS 120 Project 5 solution

$29.99

Original Work ?
Category:

Description

5/5 - (1 vote)

For this project you will design, implement, and test an abstract C++ class with polymorphism.
Design You will need to do the following: 1. Create an abstract class that has at least two subclasses. 2. The subclasses must override the pure virtual method(s) in the parent class. 3. Create a vector of pointers to the abstract class. 4. The vector must contain pointers to child class objects (a mixture of the 2+ subclasses). 5. You must demonstrate polymorphism by looping through the vector and calling the same method on each element (at least one method). Some examples: – A Book class that has children Textbook and Short Stories – A Chart class that has children Bar Chart and Pie Chart – A Baseball Player class that has children Pitcher and Hitter – A Vegetable class that has children Corn and Carrot
Implement Your classes should be declared in header file(s) (with RMEs and other comments) and defined in corresponding .cpp file(s). You may reuse classes from previous projects if appropriate.
Test To make sure your classes are working the way you designed, include a .cpp file that has the main function and tests your classes thoroughly.
Grading The project is out of 60 points. Design and Style 5 pts Are there at least three files and does each file have the correct code? Does the program compile? 6 pts Are there sufficient comments and/or writings to explain what each method accomplishes and what each field represents? Are methods const when they should be? 4 pts Do the files follow the style guidelines from class? Are they readable? Do the names make sense? 8 pts Is there evidence of a well-thought-out design? Does each method have a clear purpose? Is this the best way to implement the class given the functionality goals? 5 pts Are the methods and fields members of the correct class? Does it make sense for the parent class to have the pure virtual method(s) declared? Implementation 6 pts Are three classes implemented, an abstract parent class and two subclasses? 4 pts Are keywords “virtual” and “override” used where appropriate? 5 pts Is there a vector of pointers to the abstract class? Does it contain pointers to objects of the two child classes? 5 pts Is polymorphism demonstrated by looping through the vector and calling a parent class method on each element? Testing 4 pts Is every method tested (directly or indirectly)? 8 pts Does testing cover all possible cases?