Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Shoes
- {
- class Program
- {
- static void Main(string[] args)
- {
- // 2 вида обувки - 3 вида цветове (червен, син и черен)
- // цената / спортни и елегнантни/ цената на спортните е 6,90 лв, а 4,20 на елегантните
- // ако си купат едни спротни и едни елегантни получват 20 % of totral price
- // 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
- // if you buy in total 10 pairs of shoes u get 35%
- // input : quantity and colour and model
- // output: total price
- //input quantity
- int quantity = int.Parse(Console.ReadLine());
- string model = "";
- string colour = "";
- int counterSportShoes = 0;
- int counterElegantShoes = 0;
- int totalQuantity = 0;
- double priceSport = 6.90;
- double priceElegant = 4.20;
- double totalPrice = 0;
- int counterRed = 0;
- int counterBlue = 0;
- for (int i = 1; i <= quantity; i++)
- {
- //input model and colour
- model = Console.ReadLine();
- colour = Console.ReadLine();
- if (model == "sport")
- {
- totalPrice += priceSport;
- if (colour == "blue")
- {
- totalQuantity++;
- counterSportShoes++;
- }
- else if (colour == "red")
- {
- totalQuantity++;
- counterSportShoes++;
- }
- else if (colour == "black")
- {
- totalQuantity++;
- counterSportShoes++;
- }
- }
- else if (model == "elegant")
- {
- totalPrice += priceElegant;
- if (colour == "blue")
- {
- totalQuantity++;
- counterElegantShoes++;
- counterBlue++;
- }
- else if (colour == "red")
- {
- totalQuantity++;
- counterElegantShoes++;
- counterRed++;
- }
- else if (colour == "black")
- {
- totalQuantity++;
- counterElegantShoes++;
- }
- }
- }
- // ако си купат едни спротни и едни елегантни получват 20 % of totral price
- if (counterElegantShoes == 1 && counterSportShoes == 1)
- {
- totalPrice -= totalPrice * 0.20;
- }
- // 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
- if (counterElegantShoes == 2 && counterSportShoes == 1)
- {
- if (counterRed == 1 && counterBlue == 1)
- {
- totalPrice -= totalPrice * 0.069;
- }
- }
- // if you buy in total 10 pairs of shoes u get 35%
- if (totalQuantity == 10)
- {
- totalPrice -= totalPrice * 0.35;
- }
- //print on the console the final price
- Console.WriteLine($"{totalPrice}");
- //int quantity = int.Parse(Console.ReadLine());
- //string colour1 = Console.ReadLine();
- //string colour2 = Console.ReadLine();
- //string colour3 = Console.ReadLine();
- //string model1 = Console.ReadLine();
- //string model2 = Console.ReadLine();
- //double priceSport = quantity * 6.90;
- //double priceElegant = quantity * 4.20;
- //double totalPrice = 0;
- //if (model1 == "Sport" && model2 == "Elegant")
- //{
- // if (quantity == 2)
- // {
- // priceElegant = priceElegant * 0.8;
- // priceSport = priceSport * 0.8;
- // totalPrice = priceElegant + priceSport;
- // }
- //}
- //else if (colour1 == "red" && colour2 == "blue" && model1 == "Elegant" && quantity == 3)
- //{
- // totalPrice = priceSport + priceElegant;
- // totalPrice = totalPrice * 0.9655;
- //}
- //else if (model2 == "Sport" && colour3 == "black" || colour1 == "red" || colour2 == "blue" || model1 == "Elegant" && quantity == 3);
- //{
- // totalPrice = priceSport + priceElegant;
- // totalPrice = totalPrice * 0.9655;
- //}
- //Console.WriteLine(totalPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement