V22.0480 - ASSIGNMENT 1


Write a Visual Basic program that provides information about a character's attributes.

Make sure you follow the submission instructions following the description of the assignment!

You will have one form, one module, and two classes.

The first class file will represent the Character class. CCharacter (note the additional "C" hungarian notation for class) has the following attributes: first name, last name and birthday. It also has another two attributes (i.e. instances or variables) of the other class in the project.

The other class in the project should be called CSkill and it should represent the value of an individual skill of the character. For this assignment, CSkill need only contain a long integer, a property for reading that long integer, and the Class_Initialize event method in which you will initialize the long integer to some random value between 1 and 100.

The Character class will itself contain two variables of the CSkill class, one representing Offensive Skill and one representing Defensive Skill of the character.

Birthdate must be stored internally in the Character class using variables representing month, day and year and it must be displayed in format mm/dd/yyyy (e.g. 12/31/1985).

After the main form is displayed you are to request from the user the first and last name for the character and change it in the character object. The month day and year of the character are initially randomly generated to create a starting default value (see possible date range in next paragraphs).

You should have one form which displays the first and last name, the birth date of the character, the offensive skill value and the defensive skill value.

There should be two buttons on the form which allow you to change the first and last name respectively to strings the user specifies. There should also be buttons to add a user-supplied number of days, months and years to the randomly generated default value (this should work any time the buttons are clicked). For purposes of this simulation you may assume that there are 12 months in a year, every month has 30 days, and the starting year is 1950 and the last possible birthdate is February 4, 2003.  That is, if the new birthdate would be later than 02/04/2003 you must not change the birthdate and you must let the user know that the maximum has already been reached.  A birthdate before 01/01/1950 should not be allowed.

All attributes and changes to them must be reflected in the window (see example below).

You are to use properties in the CCharacter class to expose the first name, last name and birthdate (in mm/dd/yyyy format) attributes to the rest of the application. You are also to use properties in the CCharacter class to access properties in the CSkill class when necessary for the character to display its skill(s).

You are to perform any necessary calculations in the module (except for those that should naturally be in the class).  Your CCharacter class instance is also in the module.

Your form code is to call functions in the module and update the display as necessary.

Notes and Hints:

    Use the InputBox function to read in the name

    Use the Msgbox statement to inform the user of any significant events

    Try to follow object-oriented design principles and also avoid unnecessary duplicate code

    You may use the sample code I have posted on the web site as a starting point.

    Extra credit of 2 points will also be given for consistent use of "Hungarian Notation"


The window should look like this when your program starts:


After setting the first and last names it should look like this:



SUBMISSION INSTRUCTIONS:

  • Your project should be named [your...] lastname_firstname.vbp
  • When developing make sure ALL your files (project, form, module and classes) are in one directory; if your program cannot run from within one directory you will lose points
  • The only files you should be emailing are the ones ending in .vbp (the project file), .frm (the form, and not .frx), .bas (i.e. the module file) and .cls (i.e. the class files).
  • ALL your files should have a header with your lastname and first name and a description of what the file is (except the .vbp file of course)
  • You may use winzip to zip the files (no tar zips, etc.).
  • If your program cannot run YOU WILL NOT GET CREDIT. Make sure you "Run->Start with Full Compile" before submission to ensure your program will compile.

  •  
  • ASSIGNMENT MUST BE RECEIVED AT sab275@nyu.edu BY 6 PM on February 11, 2003.
  • In Subject line put EXACTLY the following:

  •     RTG: HW1
    [note the space between : and H]
  • You MUST hand in a printout of the code (only the form CODE, class and module) in class at the start on February 11th as well.  Print from within Visual Basic (do NOT use Word or Notepad).

  • Updated January 31, 2003