using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class System : ISystem { private string name; private string version; private string sn; private bool isOn = false; public System(string name, string version, string sn) { this.name = name; this.version = version; this.sn = sn; } public string Name => this.name; public string Version => this.version; public string SN => this.sn; public override string ToString() { return $" - Name: {this.name}\n - Version: {this.version}"; } public bool Start() { if (this.isOn) return false; Console.WriteLine($"System starting..."); this.isOn = true; return true; } public void Restart() { Console.WriteLine("System restarting in:"); for (int i = 3; i > 0; i--) { Console.WriteLine(i); Thread.Sleep(1000); } this.Quit(); this.Start(); } public bool Quit() { if (!this.isOn) return false; Console.WriteLine($"System quiting..."); this.isOn = false; return true; } } }