using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KonKopiujący { class Komputer { bool stan; string colour; double processor; int graphic; public Komputer() { stan = false; processor = 3.16; graphic = 2048; } public void check() { if(stan) { Console.WriteLine("Komputer jest wlaczony!"); } else { Console.WriteLine("Komputer jest wylaczony!"); } if(processor==3.16 && graphic==2048) { Console.WriteLine("Procesor i grafika w trybie oszczędności energii "); } else { Console.WriteLine("Procesor i grafika w trybie wyższej wydajności"); } } public void start() { if(stan) { stan = false; } else { stan = true; } } public void tryb(ref Komputer x) { if (stan) { if (x.processor == 3.16 && x.graphic == 2048) { x.processor = 3.26; x.graphic = 4096; } else { x.processor = 3.16; graphic = 2048; } } else { Console.WriteLine("Komputer jest wylaczony!"); } } private void boost(Komputer x) { x.processor += 3.55; x.graphic += 6144; } public Komputer(Komputer x) { this.stan = x.stan; this.processor = x.processor; this.graphic = x.graphic; } ~Komputer() { Console.WriteLine("Konstruktor Komputer"); } } class Mp3 { bool stan; bool battery; int songs; int memory; public Mp3() { stan = false; battery = true; songs = 666; memory = 1024; } public void start(ref Mp3 x) { if (x.stan) { x.stan = false; } else { x.stan = true; } } public void check(Mp3 x) { if(stan&&battery) { Console.WriteLine("Urzadzenie jest wlaczone!"); } else { Console.WriteLine("Urzadzenie jest wylaczone!"); } if (battery) { Console.WriteLine("Baterie sa wlozone!"); } else { Console.WriteLine("Brak bateri!"); } Console.WriteLine("W pamieci jest: " + songs); Console.WriteLine("Pamiec wynosi: " + memory); } public Mp3 (Mp3 x) { this.stan = x.stan; this.battery = x.battery; this.songs = x.songs; this.memory = x.memory; } private void boost (Mp3 x) { x.memory += 2048; } ~Mp3() { Console.WriteLine("Konstruktor MP3"); } } class Program { static void Main(string[] args) { Komputer laptop = new Komputer(); Mp3 samsung = new Mp3(); int wybor; Console.WriteLine("Witaj w menu! Wybierz urzadzennie: 1. Komputer 2.Mp3"); wybor = int.Parse(Console.ReadLine()); switch (wybor) { case 1: laptop.check(); Console.WriteLine("Wybierz, co chcesz zrobic: 1.Wlacz komputer 2.Zmien 3.Wyjdz "); wybor=int.Parse(Console.ReadLine()); if (wybor != 3) { switch (wybor) { case 1: laptop.start(); break; case 2: laptop. } } } } } }