C# Project

profilejuny00605

For this assignment you will want to start with a Character class that contains at least a name string, a health int, and a statusEffect string. You will need an IUsable interface that has a Use method that doesn’t return anything, but takes in a Character as a parameter. An abstract Item class will implement this IUsable interface. The Item class will need a minimum of an intEffect int, a strEffect string, and a description string. The Item class shouldn’t have an implementation for the Use method, you will need to use the abstract keyword with the method signature to avoid errors for not having a method body.

Two classes will inherit from the Item class: Potion and StatusMedicine. Potion’s Use method will add its int effect value to the Character parameter’s health and set this new value as the Character’s health. The StatusMedicine’s Use method will make the Character parameter’s statusEffect string an empty string if the StatusMedicine’s string effect value matches the Character’s statusEffect value, or if the StatusMedicine’s string effect value is “all” then it will always set the Character parameter’s statusEffect to an empty string.

 

The Program.cs Main method will be used to give the user access to this functionality. Similar to your previous code exercise, you will need to give the user several options and accept input from the user for a selection. The Program will need a Character to be the target of these options. The following options will need to be available: giving the Character a status effect(setting the statusEffect member), using a Potion on the Character(instantiates a Potion and calls that Potion’s Use method), using a StatusMedicine on the Character(instantiates a StatusMedicine and calls that StatusMedicine’s Use method).

    • 10 years ago
    • 5
    Answer(0)
    Bids(0)