Question: Homework #6 Instructions In C# Create a class that represents a Weapon for a computer game. The Weapon class has the following Properties: Name, Range,

Homework #6

Instructions

In C#

Create a class that represents a Weapon for a computer game. The Weapon class has the following Properties: Name, Range, and Damage. The Range and Damage cannot have a negative value. The Weapon class has the following derived classes: Spell, MeleeWeapon, and Projectile. The Spell class has a property that indicates the number of skill points required to cast the spell. For example: a stun spell needs 2 skill points to be cast. The MeleeWeapons range property must be 1. No other value is allowed for it. An example of a MeleeWeapon is a Mace. The Projective weapon has an ammo type property. For example: a bow has an arrow as its ammo type. Make sure each class has a ToString method.

Create a class that represents a Player with a Name and a Weapon. It must have a constructor that accepts arguments for the name and weapon. Plus, is must have a ToString method.

In the main routine, create a Player using the constructor that accepts a Name and Weapon then print it. Change the player's weapon to something different and then print the player object again.

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!