CSC 308 Sample Final Exam

ABOUT THIS SAMPLE: This is an example of the project-related portion of the final exam. See lecture notes Week 11 for discussion of short-answer question topics that may appear on this year's final.

Instructions: Given below is a general analysis for a proposed data processing system. Following the general analysis are the final exam questions to be answered.

The exam is open-book, open-note. It is worth a total of 120 points; individual point values for each question are given below. Please answer each question starting on a separate sheet of paper. You have three hours to complete the exam, but you may well be able to complete it in less time than that.

General Problem Analysis

AdMail Systems Inc. wants to automate their business. At present, they have fifty employees who type individual advertising letters using a standard word processor. The letters are mailed to potential customers who may be interested in purchasing certain products. What AdMail Inc. wants is an automated form of letter processing and mailing database system.

AdMail's proposed new system maintains three main databases:

  1. A customer database, consisting of potential customers to whom letters will be mailed.

  2. A form letter database, consisting of form letter templates.

  3. A prize database, consisting of prizes that can be offered to customers as inducement for them to respond to letters they receive.

For database management, the system provides basic operations to add, delete, modify, and search for records in any of the three databases. Customer database records consist of the following standard information fields: first name, middle name, last name, company name, age, street address, city, state, country, and zip code. Any number of specialized fields can be added to a customer record. These fields are used to record information such as club memberships, magazine subscriptions, or other information that can be used to target letters to particular groups of potential customers.

For the production of form letters, the system provides a simple text editor that allows the user to type and edit form letter templates. A template consists of standard text and template fill-in fields. For example, a typical form letter could have fill-in fields for customer name, address, name of business, plus other fill-ins for specialized information.

To build an actual letter, a template is first selected from the form letter database. Then the user is prompted for a set of selection criteria that define which individuals from the customer database should receive the letter. The selection criteria allow the user to select individuals by specifying values or value ranges for some or all of the fields in a customer record. For example, selection criteria could be all customers in a particular city between the ages of 20 and 50.

After the selection criteria are defined, multiple letters are generated automatically by finding all customer database records that match the criteria. For each matching customer, a personalized letter is generated by filling in the template fill-in fields with specific information from the customer database record.

A final aspect of the system deals with a prize database, which contains records with two fields: a simple prize ID and a full prize description. When a prize ID appears as a fill-in field in a letter template, the full description appears in the generated letter to be mailed.

As an example, here is a typical form letter, where the items in square brackets are customer record fill-in fields, and the items in curly brackets are prize IDs:

[FirstName] [LastName]
[Street Address]
[City], [State] [Zip]

Dear [FirstName],

As an avid sports fan, you won't want to miss this fantastic offer on the fabulous Astro 5000 golf clubs. After you work hard all week at [Company], you like to play hard on the weekends at [Golf Course Memberships]. With a set of Astro 5000 clubs in your bag, you'll be the hottest player on the course.

If you act now, you will be eligible to receive one of the following fabulous prizes:

  1. {golf digest subscription}

  2. {golf trip}

  3. {astro coupon}


Call 1-800-NEW-CLUBS now to find out more about this limited-time offer.

Final Exam Questions

  1. (16 points) Based on the general problem analysis given above, define a menu- based GUI for the AdMail system. The menubar should contain File, Edit, and Help menus as we have defined for the tools this quarter. The menubar should also contain one or more additional menus for AdMail operations.

    In your UI layout, show the expansion for the AdMail menu(s) and describe each menu item briefly. Also, show any additional initial screen layout you feel is appropriate, such as a default initial window(s). Show the expansion of AdMail menus only, NOT of File, Edit, or Help menus.

    Following the UI layout and menu descriptions, provide a brief rationale for your layout. I.e., describe why you chose the number of menus you chose, and why you do or do not have any additional initial-screen windows. Be succinct here -- i.e., brief and to the point. I'm not looking for a lengthy rationale, just a few intelligent sentences justifying your UI layout.

  2. (32 points) Define a requirements scenario showing the details of form letter generation. The scenario should be done in the style you have used for your projects this quarter. The scenario should cover the following functionality: In the interest of time, focus on UI screen layouts primarily and prose narrative secondarily. Also to save time, you need not show both empty and filled-in versions of the screens, but only the filled-in versions.

    In the context of your scenario you will need a concrete example to illustrate functionality. As the basis for this example, use the sample golf-club form letter template given in the general analysis above.

  3. (36 points) Based on the descriptions given in the General Analysis and your answers to Questions 1 and 2, define an abstract Java model for the following objects and operations:

    1. the customer database and all of its components; note that specific customer record fields are described in the third paragraph of the General Analysis

    2. the operations to add, delete, modify, and search for customer records in the database

    3. the form letter database and all of its components, including the form letter itself

    4. the operation(s) related to letter generation, as well as input/output objects not already defined in parts a or c


    Object and operation Javadoc comments are NOT required. For an object definition, "all of its components" means all components directly or indirectly referenced in the object definition. For each operation, define its inputs and outputs. For the customer database search operation, use the customer last name as the search key and assume that last names are not necessarily unique among records.

  4. (10 points) Based on your answer to Question 3, draw a UML-style class diagram for the customer database, its components, and its operations. Do NOT diagram any other objects or operations. I.e., do not diagram any objects that are not direct or indirect components of the customer database, nor any operations that do not have the customer database in their signature.

  5. (26 points) Define the following requirements formally:

    1. The list of generated letters is sorted in ascending order by customer zip code.

    2. Assuming all other selection criteria are met, a letter should only be sent to customers in the database who have not received a mailing within the last six months.

    3. No generated letter has more than five prizes offered.
    The formal specification of these requirements entails the following: For requirement (a), you may assume that zip code is a required fill-in field for all letter templates. You may also assume a method in the GeneratedLetter class of the following form:
    /** Return the value of the zip code field from a filled-in letter, as produced
        by the letter generation operation. */
    int getZip(GeneratedLetter);
    


    Requirement (b) involves the specification of dates, for which the following simplifying assumptions can be made. First, you may assume that a date is single integer representing the value of a single day, starting from Jan 1, in the year 0 AD. For simplicity, all years are assumed to have exactly 365 days, with no leap years.

    You may also assume the following static method in a Calendar class that returns today's date:
    /** Return the value of today's date (as an integer). */
    int todaysDate();
    
    Finally, you may assume an implemented method of following form, within a class that you have defined in Question 3:
    /** Return the list of customer records from the given CustomerDB that match
        the given selection criteria. */
    Collection<CustomerRecord> match(CustomerDB, SelectionCriteria);
    


    In your answer to Question 5, include the full signature of the operation(s) for which the preconditions and/or postconditions are written. Indicate with Java comments which logic applies to part (a), which to part (b), and which to part (c). Also, describe any additional components that need to be added to object definitions given in Question 3, in support of the formal logic in the preconditions and postconditions. You do not need to repeat entire object definitions; just give the name of the object and define what additional components it needs.

    If you are unsure of your logic, provide explanatory prose comments. Partial credit will be given for correct comments even if the logic is faulty.

    Note that in a full specification of the AdMail system, there are additional requirements that should be specified as preconditions and postconditions. In this exam, you are NOT responsible for any such additional requirements. That is, you are only responsible for formally specifying the three specific requirements given in items (a), (b), and (c) for Question 5.