示例#1
0
        /// <summary>
        /// display a screen to get a new furniture from the user
        /// </summary>
        /// <param name="furnitureItems">list of SeaMonster</param>
        static void DisplayGetUserFurnitureItems(List <FurnitureItems> furnitureItems)
        {
            //
            // Create (instantiate) a new FurnitureItem object
            //
            FurnitureItems userFurnitureItem = new FurnitureItems();

            DisplayHeader("Add a Furniture Item");

            //
            // Get the FurnitureItem object's proptery values from user
            //
            Console.Write("Enter Name:");
            userFurnitureItem.NameOfItem = Console.ReadLine();
            Console.Write("Enter Weight:");
            double.TryParse(Console.ReadLine(), out double weight);
            userFurnitureItem.Weight = weight;
            Console.Write("Enter Conditional State:");
            Enum.TryParse(Console.ReadLine(), out FurnitureItems.ConditionOfFurniture conditionalState);
            userFurnitureItem.CurrentCondition = conditionalState;
            Console.Write("Enter Value:");
            double.TryParse(Console.ReadLine(), out double value);
            userFurnitureItem.Value = value;

            //
            // add FurnitureItem object to list
            //
            furnitureItems.Add(userFurnitureItem);

            DisplayContinuePrompt();
        }
示例#2
0
        /// <summary>
        /// instantiate and initialize furniture item dresser
        /// </summary>
        /// <param name="name">name</param>
        /// <returns>FurnitureItem object</returns>
        static FurnitureItems InitializeFurnitureItemDresser(string name)
        {
            FurnitureItems dresser = new FurnitureItems(name);

            dresser.Weight           = 2.5;
            dresser.CurrentCondition = FurnitureItems.ConditionOfFurniture.Good;
            dresser.Room             = "Bedroom";
            dresser.Value            = 150.00;

            return(dresser);
        }
示例#3
0
        /// <summary>
        /// instantiate and initialize furniture item bed
        /// </summary>
        /// <returns>FurnitureItems object</returns>
        static FurnitureItems InitializeFurnitureItemBed()
        {
            FurnitureItems bed = new FurnitureItems();

            bed.NameOfItem       = "Bed";
            bed.Weight           = 50;
            bed.CurrentCondition = FurnitureItems.ConditionOfFurniture.Okay;
            bed.Room             = "Bedroom";
            bed.Value            = 200.50;

            return(bed);
        }