Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 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 lab4
  8. {
  9. class Computer // базовый класс
  10. {
  11. private bool stateComputer = false; // cостояние пк
  12. private bool stateDisplay = false; // состояние дисплея
  13. private bool existanceBattery = false; // наличие батареи
  14. private bool stateBattery = false; // использование батареи
  15. private int chargeBattery = 100; // заряд-разряд батареи
  16. private bool stateCharging = true; // состояние зарядки
  17. protected long timeOfWork; // время работы ПК
  18. private string computerType; // информация о ПК
  19. public DateTime now = DateTime.Now; // объект типа DateTime
  20. /// <summary>
  21. /// Конструктор, принимающий информацию о компьютере
  22. /// </summary>
  23. /// <param name="computerType"></param>
  24. public Computer(string computerType)
  25. {
  26. this.computerType = computerType;
  27. timeOfWork = now.Hour * 3600 + now.Minute * 60 + now.Second;
  28. }
  29. /// <summary>
  30. /// Возвращает информацию о компьютере
  31. /// </summary>
  32. /// <returns></returns>
  33. public string getComputerType()
  34. {
  35. return computerType;
  36. }
  37. /// <summary>
  38. /// Возвращает заряд батареи
  39. /// </summary>
  40. /// <returns></returns>
  41. public int getChargeBattery()
  42. {
  43. return chargeBattery;
  44. }
  45. /// <summary>
  46. /// Возвращает cостояние ПК
  47. /// </summary>
  48. /// <returns></returns>
  49. public bool getStateComputer()
  50. {
  51. return stateComputer;
  52. }
  53. /// <summary>
  54. /// Возвращает cостояние дисплея
  55. /// </summary>
  56. /// <returns></returns>
  57. public bool getStateDisplay()
  58. {
  59. return stateDisplay;
  60. }
  61.  
  62. /// <summary>
  63. /// Управление
  64. /// </summary>
  65. public virtual void Controller()
  66. {
  67. Console.Clear();
  68. Console.WriteLine(DateTime.Now);
  69. Console.WriteLine("_______________________________________________________________________________");
  70. Console.WriteLine("Рабочее устройство: " + getComputerType() + "\nCостояние устройства:" + getStateComputer()
  71. + "\nСостояние дисплея: " + getStateDisplay());
  72. Console.WriteLine("_______________________________________________________________________________");
  73. }
  74. }
  75.  
  76. class Desktop
  77. {
  78.  
  79.  
  80. }
  81.  
  82. class Laptop
  83. {
  84.  
  85. }
  86.  
  87. class Tablet
  88. {
  89.  
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement