Advertisement
Mike_Goodman92

Untitled

Oct 29th, 2017
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 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 Problem_2.SoftUni_Coffee_Orders
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int numberOfOrders = int.Parse(Console.ReadLine());
  14. decimal totalPrice = 0.0m;
  15.  
  16. List<string> priceList = new List<string>();
  17.  
  18. for (int i = 0; i < numberOfOrders; i++)
  19. {
  20. decimal pricePerCapsule = decimal.Parse(Console.ReadLine());
  21. string[] orderDate = Console.ReadLine().Split('/');
  22. decimal capsulesCount = decimal.Parse(Console.ReadLine());
  23.  
  24. int daysInMonth = DateTime.DaysInMonth(int.Parse(orderDate[2]), int.Parse(orderDate[1])); // Горният формат е сменен // първо пише месеци после дни // а трябва да е обратното
  25.  
  26. decimal price = ((daysInMonth * capsulesCount) * pricePerCapsule);
  27.  
  28. totalPrice += price;
  29.  
  30. priceList.Add($"The price for the coffee is: ${price:F2}");
  31. }
  32.  
  33. foreach (var price in priceList)
  34. {
  35. Console.WriteLine(price);
  36. }
  37.  
  38. Console.WriteLine($"Total: ${totalPrice:F2}");
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement