Advertisement
dim4o

Electricity

Jul 28th, 2014
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. namespace Electricity
  3. {
  4.     class Electricity
  5.     {
  6.         static void Main()
  7.         {
  8.             int numOfFloors = int.Parse(Console.ReadLine());
  9.             int numOfFlats = int.Parse(Console.ReadLine());
  10.  
  11.             string time = Console.ReadLine();
  12.             string[] arrTime = time.Split(':');
  13.  
  14.             int hours = int.Parse(arrTime[0]);
  15.             int minutes = int.Parse(arrTime[1]);
  16.  
  17.             double totalPowerConsummation = 0;
  18.  
  19.             if (hours >= 14 && hours <= 18)
  20.             {
  21.                 totalPowerConsummation = numOfFlats*numOfFloors*(125.90d + 100.53d)*2;
  22.             }
  23.             if (hours >= 19 && hours <= 23)
  24.             {
  25.                 totalPowerConsummation = numOfFlats * numOfFloors * (6*125.90d + 7*100.53d);
  26.             }
  27.             if (hours >= 0 && hours <= 8)
  28.             {
  29.                 totalPowerConsummation = numOfFlats * numOfFloors * (8 * 125.90d + 1 * 100.53d);
  30.             }
  31.             Console.WriteLine("{0} Watts", (int)totalPowerConsummation);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement