Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Problem_2.SoftUni_Coffee_Orders
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfOrders = int.Parse(Console.ReadLine());
- decimal totalPrice = 0.0m;
- List<string> priceList = new List<string>();
- for (int i = 0; i < numberOfOrders; i++)
- {
- decimal pricePerCapsule = decimal.Parse(Console.ReadLine());
- string[] orderDate = Console.ReadLine().Split('/');
- decimal capsulesCount = decimal.Parse(Console.ReadLine());
- int daysInMonth = DateTime.DaysInMonth(int.Parse(orderDate[2]), int.Parse(orderDate[1])); // Горният формат е сменен // първо пише месеци после дни // а трябва да е обратното
- decimal price = ((daysInMonth * capsulesCount) * pricePerCapsule);
- totalPrice += price;
- priceList.Add($"The price for the coffee is: ${price:F2}");
- }
- foreach (var price in priceList)
- {
- Console.WriteLine(price);
- }
- Console.WriteLine($"Total: ${totalPrice:F2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement