Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SoftuniCoffee2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfOrders = int.Parse(Console.ReadLine());
- decimal orderPrice = 0;
- for (int i = 0; i < numberOfOrders; i++)
- {
- decimal capsulePrice = decimal.Parse(Console.ReadLine());
- var dateAsText = Console.ReadLine();
- var date = DateTime.ParseExact(dateAsText, "d/M/yyyy", CultureInfo.InvariantCulture);
- int month = (int)date.Month;
- int year = (int)date.Year;
- int days = DateTime.DaysInMonth(year, month);
- decimal capsuleCount = decimal.Parse(Console.ReadLine());
- decimal order = days * capsuleCount * capsulePrice;
- orderPrice += order;
- Console.WriteLine("The price for the coffee is: ${0:F2}", order);
- }
- Console.WriteLine("Total: ${0:F2}", orderPrice);
- }
- }
- }
Add Comment
Please, Sign In to add comment