Advertisement
felix_de_suza

_1_Electricity

Sep 6th, 2014
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. class Electricity
  4. {
  5. static void Main()
  6. {
  7. int floors = int.Parse(Console.ReadLine());
  8. int flats = int.Parse(Console.ReadLine());
  9. DateTime time = DateTime.Parse(Console.ReadLine());
  10. double flatsInDorms = floors * flats;
  11. double compConsumption = 100.53;
  12. double lampConsumption = 125.90;
  13. int totalConsumption = 0;
  14. if (time.Hour >= 14 && time.Hour <= 18)
  15. {
  16. double noon = compConsumption * 2 + lampConsumption * 2;
  17. totalConsumption = (int)(noon * flatsInDorms);
  18. }
  19. else if (time.Hour >= 19 && time.Hour <= 23)
  20. {
  21. double afterNoon = compConsumption * 7 + lampConsumption * 6;
  22. totalConsumption = (int)(afterNoon * flatsInDorms);
  23. }
  24. else if (time.Hour >= 0 && time.Hour <= 8)
  25. {
  26. double midnight = compConsumption * 8 + lampConsumption;
  27. totalConsumption = (int)(midnight * flatsInDorms);
  28. }
  29. else
  30. {
  31. totalConsumption = 0;
  32. }
  33. Console.WriteLine("{0} Watts", totalConsumption);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement