Assignment #1:
Classes


Objectives: Gain experience using classes and objects.  

Description: This program is intended to provide you with experience designing classes and instantiating objects from those classes.


There are, unfortunately, several different ways to format references in a research paper.  Probably the most common ones are the APA style, the MLA style, and the Chicago style.  You can find examples of each format in the Reference Styles help sheet.

This program is the first component that you will develop in the process of designing and implementing a reference formatting system.  Notice that the different formatting styles often use variations on how the author's name is displayed, and often in how the publication or conference date is displayed.

This program will require you to create a programmer-defined clsDate class that will allow the storage and display of publication dates in different formats.  In addition, it will require you to create a programmer-defined clsName class allow the storage and display of author names in various formats.   


Required Classes

clsDate (You can use the clsDate class provided in the Example Program as a basis. )

Some publications include only a year, some include only a month and year, and some include an entire date. Therefore, your class must allow the storage of a 0 value for day for instances in which only the month and year of publication are known, and should also allow the user to specify both a 0 day and a 0 month for instances in which only the year of publication is known.  This is why we cannot use the built-in Date class.  It requires non-zero values for month, day, and year.

 


clsName


As always, the classes, instance variables and methods listed below are not exhaustive, and should be adapted as needed as you formulate your solution.  Note that initial designs evolve as system details become more evident.  However, you should contact the professor if you discover the need for any serious deviations from this general design.


The application should implement the interface below so that both the date and name can be tested.  

 

Your interface should provide all possible formatting options for the name (the demo contains only four).

Download the demo here.


Hints

Help with the combo box:

// In declarations of testFrame
private String formatList[ ] =
                 { "Last, Fir st M.", "First M. Last", "F.M. Last", "Last, F.M."};

JComboBox jComboBoxFormat = new JComboBox(formatList);


// In jbInit of frame
jPanelFormat.add(jComboBoxFormat, null);

// in
jbtnFormatName_actionPerformed
switch ( jComboBoxFormat.getSelectedIndex() )
{
     case 0:
         
jtfResult.setText(testName.getLastFirstMi());
          break;
     case 1:
         
jtfResult.setText(testName.getFirstMiLast());
          break;
     case 2:
         
jtfResult.setText(testName.getFiMiLast());
          break;
     case 3:
         
jtfResult.setText(testName.getLastFiMi());
          break;
}

// Substitute names that you selected for Items in red.