Write an application for a furniture company; the program determines the price of a table. Ask
the user to choose one for pine, 2 for oak, or three for mahogany. The output is the name of the
wood chosen as well as the price of the table. Pine tables cost $100, oak tables cost $225, and
mahogany tables cost $310. If the user enters an invalid wood code, set the price to zero. Save
the file as Furniture.cs
using System;
namespace Questions
{
    class Program
    {
        static decimal DeterminePriceOfTable(int wood)
        {
            if (wood == 1)
                return 100;
            if (wood == 2)
                return 225;
            if (wood == 3)
                return 310;
            return 0;
        }
        static void Main()
        {
            Console.WriteLine("Please select a wood:");
            Console.WriteLine("1. Pine");
            Console.WriteLine("2. Oak");
            Console.WriteLine("3. Mahogany");
            Console.WriteLine();
            Console.Write("Your choice: ");
            int choice = int.Parse(Console.ReadLine());
            Console.WriteLine();
           
            if(choice >= 1 && choice <= 3)
            {
                if (choice == 1)
                    Console.WriteLine("Wood: Pine");
                else if (choice == 2)
                    Console.WriteLine("Wood: Oak");
                else if (choice == 3)
                    Console.WriteLine("Wood: Mahogany");
            }
            else
                Console.WriteLine("Invalid wood code");
            decimal tablePrice = DeterminePriceOfTable(choice);
            Console.WriteLine("Price of the table: $" + tablePrice);
            Console.ReadKey();
        }
    }
}
Comments