Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9. class Building
  10. {
  11. public int Floors;
  12. public int Area;
  13. public int Occupants;
  14. //площа на одного чоловіка
  15. public int AreaPerPerson ()
  16. {
  17.  
  18. return Area / Occupants;
  19. }
  20. //максимальна кількість людей на задану площу
  21. //виходячи від заданої мінімальної площі на 1 особу.
  22. public int MaxOccupans (int minArea)
  23. {
  24. return Area / minArea;
  25. }
  26.  
  27. public Building( int Floors, int A, int O)
  28. {
  29. this.Floors = Floors;
  30. Area = A;
  31. Occupants = O;
  32. }
  33.  
  34.  
  35.  
  36.  
  37. static void Main(string[] args)
  38. {
  39. Building House = new Building(5, 2500, 80);
  40. Building offis = new Building(100, 9000, 1000);
  41.  
  42. Console.WriteLine("найбільша кількість людей у будинку,\n" +
  43. "Якщо на кожну особу надається 300 квад.м.\n"
  44. + House.MaxOccupans(300) + " \n площа на одного чоловіка \n"
  45. + House.AreaPerPerson() + " \n Кількість Жителів \n"
  46. + House.Occupants);
  47. Console.WriteLine("найбільша кількість людей у Офісі,\n" +
  48. "Якщо на кожну особу надається 300 квад.м.\n"
  49. + offis.MaxOccupans(300) + "\n площа на одного чоловіка \n"
  50. + offis.AreaPerPerson() + " \n Кількість Жителів \n"
  51. + offis.Occupants);
  52.  
  53. Console.ReadKey();
  54.  
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement