Advertisement
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 Programming_Fundamentals_Exams
- {
- class Program
- {
- static void Main(string[] args)
- {
- var countOfOrders = int.Parse(Console.ReadLine());
- var sum = 0m;
- for (int i = 0; i < countOfOrders; i++)
- {
- var pricePerCapsule = decimal.Parse(Console.ReadLine());
- var date = Console.ReadLine();
- var dateParsed = DateTime.ParseExact(date, "d/M/yyyy", CultureInfo.InvariantCulture);
- var capsuleCount = long.Parse(Console.ReadLine());
- var days = DateTime.DaysInMonth(dateParsed.Year, dateParsed.Month);
- var priceTotal = (days * capsuleCount) * pricePerCapsule;
- Console.WriteLine("The price for the coffee is: ${0:F2}", priceTotal);
- sum += priceTotal;
- }
- Console.WriteLine("Total: ${0:F2}", sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement