Untitled

 avatar
unknown
plain_text
2 years ago
2.5 kB
4
Indexable
using System;

namespace AnimalClass
{
    internal class Program
    {
        static void Main(string[] args)
        {

            String product = Console.ReadLine();
            String town = Console.ReadLine();
            double count = double.Parse(Console.ReadLine());

            double price = 0;

            if (town == "Sofia")
            {
                switch (product)
                {
                    case "coffee":
                        price = 0.50;
                        break;
                    case "water":
                        price = 0.80;
                        break;
                    case "beer":
                        price = 1.20;
                        break;
                    case "sweets":
                        price = 1.45;
                        break;
                    case "peanuts":
                        price = 1.60;
                        break;
                }
            }
            else if (town == "Plovdiv")
            {
                switch (product)
                {
                    case "coffee":
                        price = 0.40;
                        break;
                    case "water":
                        price = 0.70;
                        break;
                    case "beer":
                        price = 1.15;
                        break;
                    case "sweets":
                        price = 1.30;
                        break;
                    case "peanuts":
                        price = 1.50;
                        break;
                }
            }
            else if (town == "Varna")
            {
                switch (product)
                {
                    case "coffee":
                        price = 0.45;
                        break;
                    case "water":
                        price = 0.70;
                        break;
                    case "beer":
                        price = 1.10;
                        break;
                    case "sweets":
                        price = 1.35;
                        break;
                    case "peanuts":
                        price = 1.55;
                        break;
                }
            }
            double allPrice = count*price;
            Console.WriteLine((allPrice):F2); ;
                        }

    }
}

Editor is loading...