Advertisement
North_Point

01. Softuni Coffee Orders

Aug 15th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 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 _01.Softuni_Coffee_Orders
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             var count = int.Parse(Console.ReadLine());
  15.             decimal total = 0;
  16.             for (int i = 0; i < count; i++)
  17.             {
  18.                 var price = decimal.Parse(Console.ReadLine());
  19.                 var data = DateTime.ParseExact(Console.ReadLine(), "d/M/yyyy", CultureInfo.InvariantCulture);
  20.                 var capsules = long.Parse(Console.ReadLine());
  21.                 int res = DateTime.DaysInMonth(data.Year, data.Month);
  22.  
  23.                 var multy = res * capsules * price;
  24.                 total += multy;
  25.                 Console.WriteLine("The price for the coffee is: ${0:f2}",multy);
  26.             }
  27.             Console.WriteLine("Total: ${0:f2}", total);
  28.            
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement