CS251L - Fall 2012

Intermediate Programming

Section 002


Jan Monterrubio

Email: janmonterrubio@gmail.com

Office: FEC 3rd Floor Lounge or (FEC 309)

Office Hours:

Wednesday 3 - 5 PM

Friday 2 - 4 PM

Full TA and Tutor Schedule

If these times don't work email me and I'll make sure you get the help you need.


Customizeable Characters

September 11th, 2012

Background

Antifreeze Entertainment is coming up with their newest MMORPG "NeverQuest". They have realized that an important aspect to the game is customizable characters and have hired you for the job. Antifreeze requires their customers to be able to change three aspects of their character, HeadGear, UpperBodyGear, LowerBodyGear.

Requirements

You will have to write 8 classes for this assignment, as well as a GearTester.java file, which will be used to test your created objects. The classes you will have to write MUST HAVE the same exact names as listed.

  • CharacterGear
  • HeadGear
  • UpperBodyGear
  • LowerBodyGear
  • TorsoGear
  • ArmGear
  • LegGear
  • FootGear
  • MOST of these objects will have some things in common, they will need a

  • String name
  • int defense
  • method public String getStats() which will return a String in this format:
  • Name: Helmet of Might
    Defense: 25 
    

    You are required to have COMMENTS (JavaDoc Style) on your files. If you are unsure of how this would look, do not be afraid to ask us and we will post an example on the web page or to the mailing list.

    You are also required to have a GearTester.java file, in which you will have to create at least 3 different instances of CharacterGear, with different properties to the others. You can reuse some of your HeadGear, UpperBodyGear and LowerBodyGear objects when creating your different CharacterGear objects

    As you progress with this assignment, you will notice that there are many things in common between certain objects. We will learn more about how to fuse these things in common and make better design decisions in next weeks lab, this is called inheritance. Do not use inheritance (IE extends) for this lab. DO NOT USE INHERITANCE FOR THIS LAB. We will use it for next lab.

    Specifics

  • CharacterGear is composed of three elements: HeadGear, UpperBodyGear, LowerBodyGear.
    • It does not have a name (String)
    • It does not have a defense field (int)
    • The getStats() method for this class SHOULD CALL the getStats() method for HeadGear, UpperBodyGear and LowerBodyGear in that order. You can use String concatanation to return the composition of the three strings as a single string. You should split up each item as within the output section.
  • HeadGear is a single element of it's own. It has the common characteristics. You want your output to look like this:
    --- Head Gear ---
    Name: BroHat
    Def: 2
    
  • UpperBody is composed of two elements: TorsoGear, ArmGear.
    • It does not have a name (String)
    • It does not have a defense field (int)
    • The getStats() method for this class SHOULD CALL the getStats() method for TorsoGear and ArmGear in that order. You can use String concatanation to return the composition of the two strings as a single string. Your output should look like this for UpperBody:
      --- Upper Body Gear ---
      - Torso Gear -
      Name: Shirt of Doom
      Def: 50
      StaminaDecrease: 78
      - Arm Gear -
      Name: Bear Arms
      Def: 555
      StaminaDecrease: 43
      
  • TorsoGear & ArmGear both have the common characteristics . They have an extra field.
    • staminaDecrease which is a RANDOM NUMBER (int) between 1 and 100, assigned upon creation of a unique instance of either Torso or Arm Gear. This should be done at construction. THIS IS NOT A PARAMETER PASSED IN FOR THE CREATION OF THE OBJECT.
    • The getStats() method should ALSO add the string "StaminaDecrese: VAL". Where VAL is the value of the staminaDecrease for the particular item. Your output should look like this for either TorsoGear or ArmGear:
      Name: Bear Arms
      Def: 555
      StaminaDecrease: 53
      
  • LowerBody is composed of two elements: LegGear, FootGear.
    • It does not have a name (String)
    • It does not have a defense field (int)
    • The getStats() method for this class SHOULD CALL the getStats() method for LegGear and FootGear in that order. You can use String concatanation to return the composition of the two strings as a single string. Your output should look like this for LowerBody:
      --- Lower Body Gear ---
      - Leg Gear -
      Name: Tight Jeans
      Def: 1
      SpeedIncrease: 2.4
      - Foot Gear -
      Name: Birkenstock Sandals
      Def: 2
      SpeedIncrease: 4.8
      
  • LegGear & FootGear both have the common characteristics . They have an extra field aswell.
    • speedIncrease which is a double computed as the defense * 2.4
    • The getStats() method should ALSO add the string "SpeedIncrease: VAL". Where VAL is the value of the speedIncrease for the particular item. THIS IS NOT A PARAMETER PASSED IN FOR THE CREATION OF THE OBJECT. Your output should look like this for either LegGear or FootGear:
      Name: Tight Jeans
      Def: 1
      SpeedIncrease: 2.4
      
  • You will have to come up with your own constructors. Remember what each Class requires in order to be created.

    Example Output

    This is a sample ouput text file
  • file
  • Skeleton File

  • there is no skeleton file, however here's a note of encouragement
  • Submission Requirements

  • You will have to submit 9 files. They must be in a zip file called "Sep11.zip". Do not send JAR files. Send them to the email cs251f12ATgmailDOTcom . The Subject of your file must be Formated as such NAME-LASTNAME-SECTION DateOfLab. IE, my submission would be Jan-Monterrubio-002 9/11
  • Once again, you will have to have a print out of your nine files. Please staple these together