Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Electricity
- {
- static void Main()
- {
- int floors = int.Parse(Console.ReadLine());
- int flats = int.Parse(Console.ReadLine());
- string timeString = Console.ReadLine();
- int flatsInDorms = floors * flats;
- double compConsumption = 100.53;
- double lampConsumption = 125.90;
- double totalConsumption = 0;
- DateTime t1start = DateTime.Parse("2012/12/12 14:00:00.000");
- DateTime t1end = DateTime.Parse("2012/12/12 18:59:00.000");
- DateTime t2start = DateTime.Parse("2012/12/12 19:00:00.000");
- DateTime t2end = DateTime.Parse("2012/12/12 23:59:00.000");
- DateTime t3start = DateTime.Parse("2012/12/12 00:00:00.000");
- DateTime t3end = DateTime.Parse("2012/12/12 08:59:00.000");
- DateTime time = DateTime.Parse(timeString, System.Globalization.CultureInfo.CurrentCulture);
- if (time.TimeOfDay > t1start.TimeOfDay && time.TimeOfDay < t1end.TimeOfDay)
- {
- totalConsumption = (compConsumption * 2 + lampConsumption * 2) * flatsInDorms;
- }
- else if (time.TimeOfDay > t2start.TimeOfDay && time.TimeOfDay < t2end.TimeOfDay)
- {
- totalConsumption = (compConsumption * 7 + lampConsumption * 6) * flatsInDorms;
- }
- else if (time.TimeOfDay > t3start.TimeOfDay && time.TimeOfDay < t3end.TimeOfDay)
- {
- totalConsumption = (int)(compConsumption * 8 + lampConsumption) * flatsInDorms;
- }
- else
- {
- totalConsumption = 0;
- }
- Console.WriteLine("{0} Watts", Math.Floor(totalConsumption));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement