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;
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();
}
}
}
Comments
Leave a comment