Advertisement
Sim0o0na

02. Cat Shirt

Jun 18th, 2018
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _02.Shirt
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double sleeve = double.Parse(Console.ReadLine());
  14.             double front = double.Parse(Console.ReadLine());
  15.             string fabric = Console.ReadLine();
  16.             string tie = Console.ReadLine();
  17.             double pricePerM = 0.0;
  18.  
  19.             double size = sleeve * 2 + front * 2;
  20.             size += 0.10 * size;
  21.             double sizeInM = size / 100;
  22.  
  23.             switch (fabric)
  24.             {
  25.                 case "Linen":
  26.                     pricePerM = 15;
  27.                     break;
  28.                 case "Cotton":
  29.                     pricePerM = 12;
  30.                     break;
  31.                 case "Denim":
  32.                     pricePerM = 20;
  33.                     break;
  34.                 case "Twill":
  35.                     pricePerM = 16;
  36.                     break;
  37.                 case "Flannel":
  38.                     pricePerM = 11;
  39.                     break;
  40.                 default:
  41.                     break;
  42.             }
  43.             double price = pricePerM * sizeInM + 10;
  44.             if (tie == "Yes")
  45.             {
  46.                 price += 0.20 * price;
  47.             }
  48.             Console.WriteLine($"The price of the shirt is: {price:F2}lv.");
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement