CMPT 212 Assignment 4

David Simpson (simpson@cs.sfu.ca)
Fri, 14 Nov 1997 09:40:33 -0800 (PST)


CMPT 212                      Assignment 4
Fall 1997                     ------------

Due date:  Start of class, Friday, November 28, 1997.
           Late assignments will NOT BE ACCEPTED for this assignment.

1. Goal

   - To become familiar with writing Microsoft Windows programs.

2. Overview

   - This program extends Assignment 3 by adding a Windows interface.

3. Description

   - A sample program is available in the Assignment Lab.
           N:\CMPT\212\D1\Asgn4\sample.exe
   - Your program should be like the sample program as much as 
        possible.
   - The title on the main window of your program must have your
        name on it somewhere.  A suggested title is this:
           "CMPT 212 Assignment 4 (Your Name)"
   - I have created an icon and put it in the file
           N:\CMPT\212\D1\Asgn4\Asgn4.ico
        You may use it if you want to, or you may create your own icon.

4. Design of the Program

   4.1 Modules
      - Same as Assignment 3.

   4.2 The Person Module 
      - Same as Assignment 3, except for the changes described in
           Section 4.5.

   4.3 The Person-List Module
      - Same as Assignment 3, except that the output operator (<<)
           for a "plist" is not needed.

   4.4 The Main Module
      - Same as Assignment 3, except that the file will be called
           "asgn4.cpp".

   4.5 Person Class Hierarchy

      4.5.1 Person Class
         - Same as Assignment 3, except for these changes:

              - Member functions not needed:
                   void read() = 0;
                   void readName();
                   void displayName();

              - Member functions changed:
                   void display(char *) = 0;
                      This function is passed a pointer to a
                      character string, and the function writes the
                      information about the person into that string.
                      The format of the information can be seen
                      in the sample program: in the display of people
                      in the list, each line is the string returned  
                      by this function.
             
              - New member functions:
                   void setName(char *);
                      This function is passed a pointer to a 
                      character string, and sets the name of the
                      person to the value in this string. 
                   void getName(char *);
                      This function is passed a pointer to a 
                      character string, and copies the person's name
                      into this character string.         

      4.5.2 Academic Class
         - Same as Assignment 3, except for these changes:

              - Member functions not needed:
                   void readDept();
                   void displayDept();

              - New member functions:
                   void setDept(char *);
                      This function is passed a pointer to a 
                      character string, and sets the department to 
                      the value in this string. 
                   void getDept(char *);
                      This function is passed a pointer to a 
                      character string, and copies the department
                      into this character string.         

      4.5.3 Industry Class
         - Same as Assignment 3, except for these changes:

              - Member functions not needed:
                   void readCompany();
                   void displayCompany();

              - New member functions:
                   void setCompany(char *);
                      This function is passed a pointer to a 
                      character string, and sets the name of the
                      company to the value in this string. 
                   void getCompany(char *);
                      This function is passed a pointer to a 
                      character string, and copies the company name
                      into this character string.         

      4.5.4 Employee Class
         - Same as Assignment 3, except for these changes:

              - Member functions not needed:
                   void readSalary();
                   void displaySalary();

              - New member functions:
                   void setSalary(int);
                      This function is passed an integer, and sets 
                      the salary of the employee to this value.
                   void getSalary(int&);
                      This function is passed a reference to an
                      integer, and returns the employee's salary
                      in this integer.         

      4.5.5 Student Class
         - Same as Assignment 3, except for these changes:

              - Member functions not needed:
                   void read() = 0;

              - Member functions changed:
                   void display(char *) = 0;
                      See the "person" class for a description of
                      this function.
            
      4.5.6 Instructor Class
         - Same as Assignment 3, except for these changes:

              - Member functions not needed:
                   void read() = 0;

              - Member functions changed:
                   void display(char *) = 0;
                      See the "person" class for a description of
                      this function.

      4.5.7 Programmer Class
         - Same as Assignment 3, except for these changes:

              - Member functions not needed:
                   void read() = 0;

              - Member functions changed:
                   void display(char *) = 0;
                      See the "person" class for a description of
                      this function.

5. Design Features

   5.1 Error Checking [same as Assignment 3]
      - Very little error checking needs to be done.
      - The program does not have to check for out-of-memory errors
          or input errors.

   5.2 Given Code
      - No code is given to you.
      - This program is based on Assignment 3.  If you prefer, you
          may base your program on my solution to Assignment 3, rather
          than on your solution to Assignment 3.

   5.3 List Implementation [same as Assignment 3]
      - The elements in the list must be allocated using the memory
          allocation operator "new", and must be released using the
          memory release operator "delete".
      - Each element in the list must not contain the person data, but
          must contain a pointer to an instance of either a "student"
          instance, an "instructor" instance, or a "programmer" instance.
          These instances should be allocated dynamically.

   5.4 Constants [same as Assignment 3]
      - The maximum length of a person's name (20), the maximum length
          of a department's name (4), and the maximum length of a
          company's name (15) must be defined as constants in the program.  Each of
          these constants must be defined in one location so that it
          can be changed easily.

   5.5 Bool Type [same as Assignment 3]
      - If you are using a compiler which does not support the "bool"
          type, you must define the "bool" type yourself in a header
          file called "bool.h".  Your program must be able to compile
          without errors under the Borland C++ in the Assignment Lab.

   5.6 Miscellaneous [same as Assignment 3]
      - Use "const" wherever possible.
      - Use referenes ("&") when appropriate.
      - Use the smallest scope and lifetime for every variable,
          constant, and function.

6. Source Code Comments [same as Assignment 3]
   - Your source code must be fully commented.
   - An example of good commenting style is shown in my solution to
       Assignment 2.

7. Test Runs
   - Do "print screens" of these windows:
        a. the main window with an empty list.
        b. the main window with a list of 3 persons: 1 student,
              1 instructor, and 1 programmer.
        c. the main window with the "List" menu visible.
        d. the "Add Student" dialog box.
        e. the "Add Instructor" dialog box.
        f. the "Add Programmer" dialog box.
        g. the "Clear List" confirmation message box.

8. What to Hand In
   - Title page containing:
        a. Course number
        b. Assignment number
        c. Student name
        d. Student number
        e. Student email address
   - Listing of the source code in this order:
        a. asgn4.cpp
        b. person.h
        c. person.cpp
        d. plist.h
        e. plist.cpp
        f. bool.h  (if written -- see Section 5.5 above)
   - The "print screens" described in Section 7 above.

9. Marking [same as Assignment 3]
   - Besides the usual reasons for deducting marks (such as not
       handing in all of your code, or your program doesn't work
       completely), marks may be deducted for these reasons:
         - bad coding style
         - inconsistent coding style
         - bad commenting style
         - code which is difficult to understand
         - poor variable/constant/function names
         - failing to meet the requirements described here

10. Ammendments to this Assignment [same as Assignment 3]
   - Ammendments to this assignment may be emailed or posted on the
       web page.  Ammendments may be made to correct errors here
       or to clarify points.  Check your email regularly.

(end of assignment)