Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Electricity
- {
- class Electricity
- {
- public static void Main(string[] args)
- {
- int floors = int.Parse(Console.ReadLine());
- int flats = int.Parse(Console.ReadLine());
- string timeStr = Console.ReadLine();
- DateTime time = Convert.ToDateTime(timeStr);
- int hour = time.Hour;
- int minutes = time.Minute;
- double lampConsumption = 100.53;
- double pcConsumption = 125.9;
- double flatsAll = (double)floors * flats;
- int consumption = 0;
- if(hour >= 14 && hour <= 18 && minutes >= 00 && minutes <= 59)
- {
- consumption = (int)Math.Truncate(flatsAll * (2 * lampConsumption + 2 * pcConsumption));
- Console.WriteLine(consumption + " " + "Watts");
- }
- else if(hour >= 19 && hour <= 23 && minutes >= 00 && minutes <= 59)
- {
- consumption = (int)Math.Truncate(flatsAll * (7 * lampConsumption + 6 * pcConsumption));
- Console.WriteLine(consumption + " " + "Watts");
- }
- else if(hour >= 00 && hour <= 08 && minutes >= 00 && minutes <= 59)
- {
- consumption = (int)Math.Truncate(flatsAll * (1 * lampConsumption + 8 * pcConsumption));
- Console.WriteLine(consumption + " " + "Watts");
- }
- else
- {
- consumption = (int)Math.Truncate(flatsAll * (0 * lampConsumption + 0 * pcConsumption));
- Console.WriteLine(consumption + " " + "Watts");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment