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 Furniture
{
class Program
{
static void Main(string[] args)
{
int material = -1;
Console.WriteLine("Enter the material (1 - pine, 2 - oak, 3 - mahogany)");
material = int.Parse(Console.ReadLine());
if (material == 1)
Console.WriteLine("А pine table will cost $100");
if (material == 2)
Console.WriteLine("А oak table will cost $225");
if (material == 3)
Console.WriteLine("А mahogany table will cost $310");
if (material != 1 && material != 2 && material != 3)
Console.WriteLine("А table made of unknown material will cost $0");
}
}
}
Comments
Leave a comment