ProductsLogo
LogoStudy Documents
LogoAI Grader
LogoAI Answer
LogoAI Code Checker
LogoPlagiarism Checker
LogoAI Paraphraser
LogoAI Quiz
LogoAI Detector
PricingBlogAbout Us
logo

CE03: Character and Item Classes

Verified

Added on  2019/09/30

|3
|1002
|81
Project
AI Summary
Create a Visual Studio project named 'FirstnameLastname_ CE03' using C# Console Application template. Implement an interface IUsable and abstract class Item that inherits from it. Create classes Potion and StatusMedicine that inherit from Item. The Potion's Use method adds its int effect value to the Character parameter's health, while the StatusMedicine's Use method sets the Character parameter's statusEffect string to an empty string if it matches or is 'all'. Implement user options for setting the statusEffect, using a Potion, and using a StatusMedicine.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Setup:
You will be creating a new Visual Studio project named "FirstnameLastname_CE03" using the
C# Console Application template.
Grading:
Please refer to the CE:03 tab of this rubric to understand the grading procedures for this
assignment.
Deliverables:
You will compress and upload a file named "FirstnameLastname_CE03.zip" with the following
contents with the following names:
Project - Folder containing your entire project and all files necessary to build the
project(csproj, .cs files, App.config, and Properties folder).
Be sure to upload the correct project and all required files the first time as only one submission
will be allowed. No extra time or consideration will be given if the wrong files are uploaded.
Instructions:
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).

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
The following guidelines are the grading categories for this assignment:
Class Creation:
Create an interface called IUsable.
The IUsable interface should have a Use function that has no return type and takes in a
Character parameter.
Create an abstract class called Item that implements IUsable.
The Item class should contain 3 member variables: string strEffect, int intEffect, and
string description.
The Use method does not need to have a functioning body in Item as there is no
functionality for the base Item class. To get rid of the error about needing the Use
method you can declare the method as abstract using the abstract keyword.
Create a Potion class that derives from the Item class. The Use functionality will be
described in a different section.
Add a string field to the Character class called statusEffect.
Create a StatusMedicine class that inherits from Item. The Use functionality will be
described in a different section.
Use Implementations:
Potion’s Use should add its intEffect value to the Character parameter’s health.
StatusMedicine’s Use should check if its strEffect is equal to the Character parameter’s
statusEffect. If the statusEffect and strEffect match (case insensitive match) then the
Character’s statusEffect should be set to an empty string.
If the StatusMedicine’s strEffect is equal to “all” (case insensitive match) then the
Character parameter should be set to an empty string.
User Options:
Create an option that lets the user set the statusEffect value of the mainCharacter.
Create an option that instantiates a potion and proceeds to use it on the mainCharacter.
(The Potion’s int effect can either be set by user input or set to some default value other
than 0.)
Create an option that instantiates a StatusMedicine and uses it on the mainCharacter.
(The StatusMedicine’s strEffect should be set by user input.)
Document Page
Create an option that clearly display all values of the Character object in Program.
Extra Information
Go back through your code and check for the following:
All variables and methods are named appropriately.
Member variables should have either protected or private access.
Anytime the user is asked for input the expected input is made clear to the user.
Any information being output to the user should be clear and concise.
The user should be clearly informed of what is occurring throughout the application.
When values change or objects are instantiated information about this occurrence
should be displayed.
Make sure that the program does not exit until the user chooses to exit and they can
continue to select different options until they choose to exit.
Make sure the user can’t select an option that accesses an object that doesn’t exist.
Other than the variable of type character in the program class, no static variables or
methods should be used.
1 out of 3
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]