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); }
///
///
///
///
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started