Question: Required Enums Create and implement the following enumerations. 1. State Opened Closed Locked 2. LockType Novice Intermediate Expert 3. Material Oak Iron Gold 4. LootQuality


Required Enums
Create and implement the following enumerations.
1. State
Opened
Closed
Locked
2. LockType
Novice
Intermediate
Expert
3. Material
Oak
Iron
Gold
4. LootQuality
Grey
Green
Purple
Required Functions
Implement all functions that have throw new NotImplementedException();
1. ManipulateTreasureChest
See Task 2 in the instructions.
2. GetLockType
Returns the enum value for LockType based on user input. If the user inputs an invalid option, set the LockType to Novice. 3. GetMaterial
Returns the enum value for Material based on user input. If the user inputs an invalid option, set the Material to Oak. 4. GetLootQuality
Returns the enum value for LootQuality based on user input. If the user inputs an invalid option, set the LootQuality to Grey.
Example Output
1. Creating the chests:
2. Writing the chests:
3. Manipulating the chests:
the program.cs file whre code should be inputteed is here:
using System;
namespace ConsoleApp1 { class Program {
// declare enumerations here public static void Main(string[] args) { // declare array here
//Uncomment these functions out when ready: //CreateChests(); //ManipulateTreasureChest(); }
public static void CreateChests((Enum state, Enum lockType, Enum material, Enum lootQuality)[] chests) { for(int i = 0; i
foreach(var chest in chests) { Console.WriteLine(); Console.WriteLine("---------------------------"); Console.WriteLine("A chest with the following properties has been created: "); Console.WriteLine("Material: " + chest.material); Console.WriteLine("Lock Type: " + chest.lockType); Console.WriteLine("Loot Quality: " + chest.lootQuality); Console.WriteLine("---------------------------"); } }
public static (State, LockType, Material, LootQuality) GetChest((Enum, Enum, Enum, Enum) chest) { State startingState = State.Locked; LockType startingLockType = GetLockType(); Material startingMaterial = GetMaterial(); LootQuality startingLootQuality = GetLootQuality(); return (startingState, startingLockType, startingMaterial, startingLootQuality); }
///
///
///
///
Introduction All code should be added to the Program.cs file provided in the Moodle section for this assignment. Task 1 Write a program that uses tuples and enumerations that allows the user to create different types of treasure chests. Task 2 Create a program with enermations that allows the user to go between the states of opening, closing, locking, and unlocking a treasure chest. Instructions Task 1: 1. Define the required enumerations. 2. In Main, create a tuple array of length 3 that represent the treasure chests where each tuple is composed of each enumeration. 3. Implement the GetMaterial, GetLockType, and GetLootQuality functions that allow for the users to select the value for each enumeration. 4. When ready (and in Main), correctly call the CreateChests function. Task 2: Implement the following code in ManipulatreTreasureChest 1. Write code that allows the user to manipulate the chest by opening, closing, locking, and unlocking the chest. - Make sure the user can't perform incompatible steps (example: Opening a lock chest, locking an opened chest, etc.) 2. Loop asking for the next command until the user enters the command 5. 3. When ready (and in Main), correctly call the ManipulatreTreasureChest function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
