Assignment 3 –Invitation Letter Generator

Maximum Points = 50

 

 The purpose of this lab is to introduce you to the creation of objects in the Java programming language. In this lab you will write a program that requests information from the user and then generates an invitation letter to a theatrical or musical performance.

 

v    Your program must ask the user for the name and address of the sender [HINT: Use JOptionPane.showInputDialog as shown on page 29 (exercise P1.10)] and create an object.

v    Your program must ask the user for the name and address of the invitee. [HINT: Use JOptionPane.showInputDialog as shown on page 29 (exercise P1.10)] and create an object.

v    Your program must ask the user for the name of the performance, date of performance, and anything else you feel is important for the user to specify to inform the guest of the performance, and create an object of class Letter.

v    Your program must display (print) the letter on the screen.

v    Your program must include a class named PersonalData that contains instance variable(s) for name, address, and phone number (complete with constructor, get and set methods for each instance variable, and a toString method that returns the contents of the instance variables)

v    Your program must include a class named Letter that contains instance variable(s) for the guest’s personal data, the sender’s personal data, and any personalized data about the performance (complete with constructor, get and set methods for each instance variable, and a toString method that returns the contents of the instance variables)

o      One of your get methods should be getLetter which returns the entire text of the letter with content similar to the following:

 

123 Main St.

Anywhere, GA 31111

 

Dear Ms. Iwanta C. A. Play,

 

First line of body

Second line of body

:

last line of body

 

Sincerely,

 

William Shakespeare

          HINT:

1. Use the concat method (or “+” to form a longer string from two shorter strings).

2. Use “\n” to represent a new line.

v     

 

EXTRA CHALLENGE: add more personalization to the letter; use the Scanner class instead of JOptionPane.

 

Make sure that your program uses proper indentation and complete documentation. See http://csc.columbusstate.edu/summers/NOTES/1301/style.htm for guidelines.

The program heading should occur at the top of the program and should include:

               /**
                * PROGRAM SPECIFICATIONS
                * NARRATIVE DESCRIPTION:
                *
                * @author (your name) 
                * @version (date)
                */

 

 

 (Due before 8 am on Wednesday, September 28, 2011) Submit your .java files containing your program and your timesheet documenting your time to the dropbox in WebCT..

 Grades are determined using the following scale:

Grading Rubric  (Word document)