Question: This is a design exercise. YOU ARE NOT CODING! Your job is to read details from the following description of part of a game, and

  1. This is a design exercise. YOU ARE NOT CODING! Your job is to read details from the following description of part of a game, and design an inheritance hierarchy as a UML Class Diagram showing your design for the relevant classes in your design.
  1. As was the case in our HW5-2 assignment, youll need to design with at least one Interface and at least one superclass [i.e., related to the game described] and at least one subclass.
  2. Your UML classes should show relevant fields (instance variables) with access level (- for private, # for protected, + for public). Abstract classes should be underlined [or italicized if you are using a diagramming tool].
  3. Each class or interface should show relevant methods and access level. Methods should show name, parameters, and return type. Underline [or italicize] abstract methods in your design.

5. Problem Description

By way of background, there are many computer games that involve characters who engage in contests or battles with other characters.

  • Typically, characters have a Health score that starts out at some number, and decreases as foes inflict damage. (A character dies if health points decrease to zero.)
  • Often, games have some mechanism to restore health through some procedure like visiting a hospital.
  • In some games, charms or other devices can enhance the powers of a character
  • Typically, characters can acquire devices or tools or charms as they are manipulated by the human player(s) of the game

You are to design classes (and interface(s)) for ITEMs that could be collected in a bag by players in a game. [A bag is a single polymorphic List of Item.]

All items can be used by or on a game character. All Items can be added to any character's bag and also used on any character. (For instance, the Rusty Knife could be used on a character to lower their health by 3 points.)

Armor and weapons can be equipped (worn) and removed. Spells can also be equipped (memorized) which casts a glow around the character and removed (forgotten) which removes the glow.

Both spells and letters have some text that could be read. Whenever a spell or letter is used, the text will also be read (displayed). However, these items can be read independently from their use on a character.

Here are examples of Items that can be acquired:

Item

type of item

effectOnHealth

other info

Widow's Cloak

Armor

+15

Gladiator's Shield

Armor

+8

Rusty Knife

Weapon

-3

Protection Spell

Spell

1

has magic words that can be read

Note from Zelda

Letter

0

says "Beware of the Witch"

  1. Create an original design for a hierarchy of Item using good interface and abstract class design as appropriate.

7. Sketch your design diagram, take a scan or image, and upload as a pdf, jpg, or png file as your deliverable. [Could alternatively add image to a Word doc and add some comments if needed.]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!