References Project Deliverable 5 Inheritance and Interfaces

Module 5 Objectives (From course objectives 1 and 2) By the time students have completed this module, they will be able to do the following: 1. Design, create, and trace C# code using inheritance, derived classes, and interfaces. Abstract classes

Deliverable Description: This program is intended to provide you with experience in designing derived classes and interfaces.

Previous deliverables have provided a beginning for the reference formatter program, but there is much work to be done. You recently created a Reference class that was envisioned as serving as a base class for more specific derived classes. As it stands, Reference is too generic to define real objects; we need to be more specific before we can think of instantiating actual references such as books, chapters, and journals.

The base class in our project, Reference, contains data and methods to work with items that are common to all references. Our project will implement three types of references: books, chapters, and journals. In this deliverable, you will add three new derived classes that contain the following additional information about a reference:

Book Class (Inherits from Reference)

Publisher City State Country

Journal Class (Inherits from Reference)

Journal Name Journal Volume Volume Number Beginning Page Number Ending Page Number

Chapter Class (Inherits from Book)

Chapter Title (Title class object) Editor Names (List of Reference Names) Beginning Page Number Ending Page Number

In addition, each of these new classes will contain methods to format the reference using the following three formats: MLA, APA, and LibMed. We will create an Interface named IFormatReference that will be implemented by the base class (Reference), to force each derived class to implement the following three methods.

string formatMLA() string formatAPA() string formatLibMed()

Perform the following major steps:

1. Create an interface named IFormatReference that contains the method headers for the three methods to format for MLA, APA, and LibMed references.

2. Modify the Reference class to be abstract. This will prevent the Reference class from being instantiated since it will act as the base class for the Book, Journal, and Chapter classes.

3. Modify the Reference class to implement the IFormatReference interface.

4. Add public abstract method headers for the IFormatReference methods. Do not put any code in the method body. This will force the derived classes to override these methods.

5. Write the Book class with appropriate accessor/mutator methods or properties and constructors. The class should inherit from the Reference class.

6. Write the Journal class with appropriate accessor/mutator methods or properties and constructors. The class should inherit from the Reference class.

7. Write the Chapter class with appropriate accessor/mutator methods or properties and constructors. The class should inherit from the Reference class.

8. For each class, implement the three IFormatReference methods to format the reference according to the appropriate style.

9. Change the name of Form1 to ManageReferencesform.

10. Place a menu on the ManageReferencesForm. The menu should have the following items:

File Add Reference Help Open References from a Data file… Book About Save References to a Data file… Chapter Start New Reference List Journal Print References to a Document file Page Setup… Print Preview… Print References to a Printer Exit 11. Create a windows form for each of the reference types. Here are screen shots for the three forms : BookForm, JournalForm and ChapterForm.

Book Form Showing the MLA style for a book

Notice that multiple authors can be added to the list. The form contains buttons that format for the MLA, APA, and LibMed styles. The code in these buttons calls the appropriate method to format the reference. Chapter Form showing the APA style for a chapter

Notice that multiple authors can be added to the list and there can also be multiple editors. The form contains buttons that format for the MLA, APA, and LibMed styles. The code in these buttons calls the appropriate method to format the reference. Journal form showing LibMed style for a Journal

Notice that multiple authors can be added to the list. The form contains buttons that format for the MLA, APA, and LibMed styles. The code in these buttons calls the appropriate method to format the reference.

12. Add code to the ManageReferencesForm menu items to load the appropriate form when the menu item is selected. 13. Create a Class diagram to show the inheritance and Interface implementation structure

As with all the deliverables for the CS1182 Reference project, in doing this next deliverable, you may either use your solution for previous exercise or the class-provided solution.

Zip your project folder and upload the zipped folder to Moodle Deliverable 5 Submission