Answer to Question #311377 in C# for Geo

Question #311377

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


1
Expert's answer
2022-03-14T13:04:59-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Furniture
    {
        static void Main(string[] args)
        {
            Console.WriteLine("1 - pine");
            Console.WriteLine("2 - oak");
            Console.WriteLine("3 - mahogany");

            Console.Write("Choose material: ");

            int material = Convert.ToInt32(Console.ReadLine());

            switch (material)
            {
                case 1: Console.WriteLine("Pine, price: $100");break;
                case 2: Console.WriteLine("Oak, price: $225"); break;
                case 3: Console.WriteLine("Mahogany, price: $310"); break;
                default: Console.WriteLine("Invalid code, price: $0"); break;
            }

            Console.ReadKey();
        }
    }

 

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS