Advertisement
desislava_topuzakova

Untitled

Aug 25th, 2024
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. double neededProfit = double.Parse(Console.ReadLine());
  2.  
  3. string command = Console.ReadLine();
  4.  
  5. double priceOfCocktail = 0;
  6. double finalPrice = 0;
  7.  
  8. while(command != "Party!")
  9. {
  10. int numOfCocktails = int.Parse(Console.ReadLine());
  11.  
  12. priceOfCocktail = command.Length;
  13. double priceOfOrder = priceOfCocktail * numOfCocktails;
  14.  
  15. if (priceOfOrder % 2 != 0)
  16. {
  17. priceOfOrder *= 0.75; // Прилагаме отстъпката само към текущата поръчка
  18. }
  19.  
  20. finalPrice += priceOfOrder; // Добавяме коригираната поръчка към общия приход
  21.  
  22. if (finalPrice >= neededProfit)
  23. {
  24. Console.WriteLine("Target acquired.");
  25. Console.WriteLine($"Club income - {finalPrice:f2} leva.");
  26. break;
  27. }
  28.  
  29. command = Console.ReadLine();
  30. }
  31.  
  32. if (finalPrice < neededProfit)
  33. {
  34. Console.WriteLine($"We need {neededProfit - finalPrice:f2} leva more.");
  35. Console.WriteLine($"Club income - {finalPrice:f2} leva.");
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement