Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace lab4
- {
- class Computer // базовый класс
- {
- private bool stateComputer = false; // cостояние пк
- private bool stateDisplay = false; // состояние дисплея
- private bool existanceBattery = false; // наличие батареи
- private bool stateBattery = false; // использование батареи
- private int chargeBattery = 100; // заряд-разряд батареи
- private bool stateCharging = true; // состояние зарядки
- protected long timeOfWork; // время работы ПК
- private string computerType; // информация о ПК
- public DateTime now = DateTime.Now; // объект типа DateTime
- /// <summary>
- /// Конструктор, принимающий информацию о компьютере
- /// </summary>
- /// <param name="computerType"></param>
- public Computer(string computerType)
- {
- this.computerType = computerType;
- timeOfWork = now.Hour * 3600 + now.Minute * 60 + now.Second;
- }
- /// <summary>
- /// Возвращает информацию о компьютере
- /// </summary>
- /// <returns></returns>
- public string getComputerType()
- {
- return computerType;
- }
- /// <summary>
- /// Возвращает заряд батареи
- /// </summary>
- /// <returns></returns>
- public int getChargeBattery()
- {
- return chargeBattery;
- }
- /// <summary>
- /// Возвращает cостояние ПК
- /// </summary>
- /// <returns></returns>
- public bool getStateComputer()
- {
- return stateComputer;
- }
- /// <summary>
- /// Возвращает cостояние дисплея
- /// </summary>
- /// <returns></returns>
- public bool getStateDisplay()
- {
- return stateDisplay;
- }
- /// <summary>
- /// Управление
- /// </summary>
- public virtual void Controller()
- {
- Console.Clear();
- Console.WriteLine(DateTime.Now);
- Console.WriteLine("_______________________________________________________________________________");
- Console.WriteLine("Рабочее устройство: " + getComputerType() + "\nCостояние устройства:" + getStateComputer()
- + "\nСостояние дисплея: " + getStateDisplay());
- Console.WriteLine("_______________________________________________________________________________");
- }
- }
- class Desktop
- {
- }
- class Laptop
- {
- }
- class Tablet
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement