Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.18 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Shoes
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             // 2 вида обувки - 3 вида цветове (червен, син и черен)
  10.             // цената / спортни и елегнантни/ цената на спортните е 6,90 лв, а 4,20 на елегантните
  11.  
  12.             // ако си купат едни спротни и едни елегантни получват 20 % of totral price
  13.             // if you buy one red and one blue from the elegant ones and also one sport from any colour you will get 6.9 % discount
  14.             // if you buy in total 10 pairs of shoes u get 35%
  15.  
  16.             // input : quantity and colour and model
  17.             // output: total price
  18.  
  19.             //input quantity
  20.             int quantity = int.Parse(Console.ReadLine());
  21.             string model = "";
  22.             string colour = "";
  23.             int counterSportShoes = 0;
  24.             int counterElegantShoes = 0;
  25.             int totalQuantity = 0;
  26.             double priceSport = 6.90;
  27.             double priceElegant = 4.20;
  28.             double totalPrice = 0;
  29.             int counterRed = 0;
  30.             int counterBlue = 0;
  31.  
  32.             for (int i = 1; i <= quantity; i++)
  33.             {
  34.                 //input model and colour
  35.                 model = Console.ReadLine();
  36.                 colour = Console.ReadLine();
  37.                 if (model == "sport")
  38.                 {
  39.                     totalPrice += priceSport;
  40.                     if (colour == "blue")
  41.                     {
  42.                         totalQuantity++;
  43.                         counterSportShoes++;
  44.                     }
  45.                     else if (colour == "red")
  46.                     {
  47.                         totalQuantity++;
  48.                         counterSportShoes++;
  49.                     }
  50.                     else if (colour == "black")
  51.                     {
  52.                         totalQuantity++;
  53.                         counterSportShoes++;
  54.                     }
  55.                 }
  56.                 else if (model == "elegant")
  57.                 {
  58.                     totalPrice += priceElegant;
  59.                     if (colour == "blue")
  60.                     {
  61.                         totalQuantity++;
  62.                         counterElegantShoes++;
  63.                         counterBlue++;
  64.                     }
  65.                     else if (colour == "red")
  66.                     {
  67.                         totalQuantity++;
  68.                         counterElegantShoes++;
  69.                         counterRed++;
  70.                     }
  71.                     else if (colour == "black")
  72.                     {
  73.                         totalQuantity++;
  74.                         counterElegantShoes++;
  75.                     }
  76.                 }
  77.                
  78.             }
  79.             // ако си купат едни спротни и едни елегантни получват 20 % of totral price
  80.             if (counterElegantShoes == 1 && counterSportShoes == 1)
  81.             {
  82.                 totalPrice -= totalPrice * 0.20;
  83.             }
  84.             // if you buy one red and one blue from the elegant ones and also one sport from any colour you will get 6.9 % discount
  85.             if (counterElegantShoes == 2 && counterSportShoes == 1)
  86.             {
  87.                 if (counterRed == 1 && counterBlue == 1)
  88.                 {
  89.                     totalPrice -= totalPrice * 0.069;
  90.                 }
  91.             }
  92.             // if you buy in total 10 pairs of shoes u get 35%
  93.             if (totalQuantity == 10)
  94.             {
  95.                 totalPrice -= totalPrice * 0.35;
  96.             }
  97.             //print on the console the final price
  98.             Console.WriteLine($"{totalPrice}");
  99.  
  100.  
  101.  
  102.  
  103.             //int quantity = int.Parse(Console.ReadLine());
  104.             //string colour1 = Console.ReadLine();
  105.             //string colour2 = Console.ReadLine();
  106.             //string colour3 = Console.ReadLine();
  107.             //string model1 = Console.ReadLine();
  108.             //string model2 = Console.ReadLine();
  109.             //double priceSport = quantity * 6.90;
  110.             //double priceElegant = quantity * 4.20;
  111.             //double totalPrice = 0;
  112.  
  113.             //if (model1 == "Sport" && model2 == "Elegant")
  114.             //{
  115.             //    if (quantity == 2)
  116.             //    {
  117.             //        priceElegant = priceElegant * 0.8;
  118.             //        priceSport = priceSport * 0.8;
  119.             //        totalPrice = priceElegant + priceSport;
  120.             //    }
  121.  
  122.             //}
  123.             //else if (colour1 == "red" && colour2 == "blue" && model1 == "Elegant" && quantity == 3)
  124.             //{
  125.  
  126.             //    totalPrice = priceSport + priceElegant;
  127.             //    totalPrice = totalPrice * 0.9655;
  128.  
  129.             //}
  130.             //else if (model2 == "Sport" && colour3 == "black" || colour1 == "red" || colour2 == "blue" || model1 == "Elegant" && quantity == 3);
  131.             //{
  132.             //    totalPrice = priceSport + priceElegant;
  133.             //    totalPrice = totalPrice * 0.9655;
  134.  
  135.             //}
  136.  
  137.             //Console.WriteLine(totalPrice);
  138.         }
  139.     }
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement