Sim0o0na

Coffee

Jun 13th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace SoftuniCoffee2
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int numberOfOrders = int.Parse(Console.ReadLine());
  15.  
  16. decimal orderPrice = 0;
  17. for (int i = 0; i < numberOfOrders; i++)
  18. {
  19. decimal capsulePrice = decimal.Parse(Console.ReadLine());
  20. var dateAsText = Console.ReadLine();
  21. var date = DateTime.ParseExact(dateAsText, "d/M/yyyy", CultureInfo.InvariantCulture);
  22. int month = (int)date.Month;
  23. int year = (int)date.Year;
  24. int days = DateTime.DaysInMonth(year, month);
  25. decimal capsuleCount = decimal.Parse(Console.ReadLine());
  26. decimal order = days * capsuleCount * capsulePrice;
  27. orderPrice += order;
  28. Console.WriteLine("The price for the coffee is: ${0:F2}", order);
  29. }
  30. Console.WriteLine("Total: ${0:F2}", orderPrice);
  31. }
  32. }
  33. }
Add Comment
Please, Sign In to add comment