Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

Types of Interpersonal Relationships?

Answered: 1 week ago

Question

Self-Disclosure and Interpersonal Relationships?

Answered: 1 week ago