References Project Deliverable 4

Aggregation and Composition

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 with Aggregation and Composition.

Deliverable 4 will create a base class that will contain the common elements for all references. All references (books, journals, chapters, etc.) have the following three elements in common: Author (Names), Titles, and Dates.

This deliverable will create a class named Reference that will contain reference information for these common objects. The Reference class will contain a list of Names (Name objects), a Title object, and a Date object as instance data. There is an association between the Reference and the other objects that can be stated as follows:

  • Every Reference has a Name (or list of Name objects)
  • Every Reference has a Title
  • Every Reference has a Date

In deliverable 3 we created an association between two classes. The form class created instances of the Name class. This type of association is referred to as Aggregation.

Likewise, Deliverable 4 will create associations between the Reference, Name, Title, and Date classes.

The different reference styles require a list of names to appear in different formats. For example, here are some styles using the following three names that are in the list of Name objects for a reference:

Ann A Smith

Max M Miller

Mary K Baker

Different Name Styles

Smith, Ann A., Miller, Max M. and Baker, Mary K.

Smith, A. A., Miller, M. M. and Baker, M. K.

Smith, A. A., Max M. Miller and Mary K. Baker

Smith, Ann A., Max M. Miller and Mary K. Baker

Smith AA, Miller MM, Baker MK

A A Smith, M M Miller and M K Baker

Ann A Smith, Max M Miller and Mary K Baker

Develop a new class called Reference that has the following:

Instance Data for the Following:

Reference Title Object

Reference Date Object

List of <Name> objects for the reference names

A noarg constructor that instantiates objects for the instance data

Accessor methods (or Properties with only get methods) for the instance data. Note, do not include mutators for the instance data as the objects themselves have mutators to set the data in the object.

A member method to add an author to the list of names

A technique to return the name list in the formats shown below. You can use a method with a parameter to specify the format, or you can use separate methods for each format like the following examples:

Method Name / Value Returned by Method
getLastFirstMi / Miller, Ann A. and Turner, Jerry T
getLastFiMi / Miller, A. A. and Turner, J. T.
getLastFiMi_FirstMiLast / Miller, A. A. and Jerry T. Turner
getLastFirstMi_FirstMiLast / Miller, Ann A. and Jerry T. Turner
getLastFiMiNoCommaNoDot / Miller AA, Turner JT
getFiMiLast / A A Miller and J T Turner
getFirstMiLast / Ann A Miller and Jerry T Turner

A member method to accept a RichTextBox and a string as a parameter, and display the string in the rich text box with <i</i> tags removed and the text inside the tags italicized

Write an application to test the Reference class. This application should allow the user to enter a reference title, date, and a list of reference authors. It should then display the data in the various formats supported. The rich text box should italicize the title.

Here is an example of how the test application might appear:

Create a class diagram that models the associations between the classes in your project

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 submit the zipped folder to Moodle Deliverable 4 Submission