Facebook
From Botched Lechwe, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 201
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace KonKopiujący
  8. {
  9.  
  10.     class Komputer
  11.     {
  12.        
  13.         public bool stan;
  14.         public string colour;
  15.         public double processor;
  16.         public int graphic;
  17.        
  18.         public  Komputer()
  19.         {
  20.             stan = false;
  21.             processor = 3.16;
  22.             graphic = 2048;
  23.         }
  24.         public void Check()
  25.         {
  26.             if(stan)
  27.             {
  28.                 Console.WriteLine("Komputer jest wlaczony!");
  29.             }
  30.             else
  31.             {
  32.                 Console.WriteLine("Komputer jest wylaczony!");
  33.             }
  34.             if(processor==3.16 && graphic==2048)
  35.             {
  36.                 Console.WriteLine("Procesor i grafika w trybie oszczędności energii ");
  37.             }
  38.             else
  39.             {
  40.                 Console.WriteLine("Procesor i grafika w trybie wyższej wydajności");
  41.             }
  42.         }
  43.         public void Start()
  44.         {
  45.             if(stan)
  46.             {
  47.                 stan = false;
  48.             }
  49.             else
  50.             {
  51.                 stan = true;
  52.             }
  53.         }
  54.        public void Tryb()
  55.         {
  56.             if (stan)
  57.             {
  58.                 if (processor == 3.16 && graphic == 2048)
  59.                 {
  60.                     processor = 3.16;
  61.                     graphic = 4096;
  62.                 }
  63.                 else
  64.                 {
  65.                     processor = 3.16;
  66.                     graphic = 2048;
  67.                 }
  68.             }
  69.             else
  70.             {
  71.                 Console.WriteLine("Komputer jest wylaczony!");
  72.             }
  73.         }
  74.         private void Boost(Komputer x)
  75.         {
  76.             x.processor += 3.55;
  77.             x.graphic += 6144;
  78.         }
  79.  
  80.         public Komputer(Komputer x)
  81.         {
  82.             this.stan = x.stan;
  83.             this.processor = x.processor;
  84.             this.graphic = x.graphic;
  85.  
  86.         }
  87.  
  88.         ~Komputer() { Console.WriteLine("Konstruktor Komputer"); }
  89.     }
  90.  
  91.     class Mp3
  92.     {
  93.         bool stan;
  94.         bool battery;
  95.         public int songs;
  96.         public int memory;
  97.  
  98.         public Mp3()
  99.         {
  100.             stan = false;
  101.             battery = true;
  102.             songs = 666;
  103.             memory = 1024;
  104.         }
  105.  
  106.  
  107.         public void Start()
  108.         {
  109.             if (stan)
  110.             {
  111.                 stan = false;
  112.             }
  113.             else
  114.             {
  115.                 stan = true;
  116.             }
  117.         }
  118.  
  119.         public void Check()
  120.         {
  121.             if(stan&&battery)
  122.             {
  123.                 Console.WriteLine("Urzadzenie jest wlaczone!");
  124.             }
  125.             else
  126.             {
  127.                 Console.WriteLine("Urzadzenie jest wylaczone!");
  128.             }
  129.             if (battery)
  130.             {
  131.                 Console.WriteLine("Baterie sa wlozone!");
  132.             }
  133.             else
  134.             {
  135.                 Console.WriteLine("Brak bateri!");
  136.             }
  137.             Console.WriteLine("W pamieci jest: " + songs);
  138.             Console.WriteLine("Pamiec wynosi: " + memory);
  139.         }
  140.  
  141.         public void Dokup()
  142.         {
  143.             Console.WriteLine("Ile losowych piosenek chcesz dokupić?");
  144.             int x = 0;
  145.             x = int.Parse(Console.ReadLine());
  146.             Console.WriteLine("Dokupiono " + x + " nowych piosenek! Miłego słuchania!");
  147.             songs = songs + x;
  148.         }
  149.  
  150.        public  Mp3 (Mp3 x)
  151.         {
  152.             this.stan = x.stan;
  153.             this.battery = x.battery;
  154.             this.songs = x.songs;
  155.             this.memory = x.memory;
  156.         }
  157.  
  158.         private void Boost ()
  159.         {
  160.             memory += 2048;
  161.         }
  162.  
  163.         ~Mp3() { Console.WriteLine("Konstruktor MP3"); }
  164.     }
  165.  
  166.  
  167.     class Program
  168.     {
  169.         static void Prezent(Komputer x, Mp3 y)
  170.         {
  171.             string imie;
  172.             int wybor;
  173.             Console.WriteLine("Dla kogo chcesz kupić prezent? Podaj imie: ");
  174.             imie=Console.ReadLine();
  175.             Console.WriteLine("Wpisz 1, jeśli chcesz podarować komputer. Wpisz 2, jeśli chcesz podarować Mp3");
  176.             wybor = int.Parse(Console.ReadLine());
  177.             if (wybor == 1)
  178.             {
  179.                 Komputer Nowy = x;
  180.                 Console.WriteLine( imie+" dostal nowy komputer!");
  181.             }
  182.             else if (wybor == 2)
  183.             {
  184.                 Mp3 New = y;
  185.                 Console.WriteLine(imie + " dostal nowe mp3!");
  186.             }
  187.         }
  188.  
  189.         static void Testuj(ref Komputer x, ref Mp3 y, out int wyb, out string zmien)
  190.         {
  191.             wyb = 0;
  192.             zmien = "TEST";
  193.             do
  194.             {
  195.                 Console.WriteLine("Wpisz 1, aby zmieniac wartosci komputera. Wpisz 2, aby zmieniac wartosci Mp3. Wpisz 5, aby wyjsc");
  196.                 wyb = int.Parse(Console.ReadLine());
  197.                 switch (wyb)
  198.                 {
  199.                     case 1:
  200.                         do
  201.                         {
  202.  
  203.  
  204.                             Console.WriteLine("1. Zmiana koloru obudowy 2. Zmiana wartosci procesora 3. Zmiana wartosci pamieci karty graficznej 6. Wyjdz ");
  205.                             wyb = int.Parse(Console.ReadLine());
  206.                             switch (wyb)
  207.                             {
  208.                                 case 1:
  209.                                     Console.WriteLine("Prosze podac nowy kolor: ");
  210.                                     x.colour = Console.ReadLine();
  211.                                     break;
  212.                                 case 2:
  213.                                     Console.WriteLine("Prosze podac nowa wartosc double procesora");
  214.                                     x.processor = double.Parse(Console.ReadLine());
  215.                                     break;
  216.                                 case 3:
  217.                                     Console.WriteLine("Proszę podać nową wartość int dla pamięci karty graficznej ");
  218.                                     x.graphic = int.Parse(Console.ReadLine());
  219.                                     break;
  220.                             }
  221.                         } while (wyb != 6);
  222.                         break;
  223.                     case 2:
  224.                         do
  225.                         {
  226.  
  227.  
  228.                             Console.WriteLine("1. Zmień ilość piosenek 2. Zmień ilość pamięci 7.Wyjdz ");
  229.                             wyb = int.Parse(Console.ReadLine());
  230.                             switch (wyb)
  231.                             {
  232.                                 case 1:
  233.                                     Console.WriteLine("Prosze podać ilość nowych piosenek: ");
  234.                                     y.songs = int.Parse(Console.ReadLine());
  235.                                     break;
  236.                                 case 2:
  237.                                     Console.WriteLine("Prosze podac nowa wartosc pamięci");
  238.                                     y.memory = int.Parse(Console.ReadLine());
  239.                                     break;
  240.                             }
  241.                         } while (wyb != 7);
  242.                         break;
  243.                 }
  244.             } while (wyb != 5);
  245.  
  246.         }
  247.         static void DokonajWyboru(out int x)
  248.         {
  249.             x = int.Parse(Console.ReadLine());
  250.         }
  251.  
  252.         static void Main(string[] args)
  253.         {
  254.             Komputer laptop = new Komputer();
  255.             Mp3 samsung = new Mp3();
  256.             Komputer TestLaptop = laptop;
  257.             Mp3 TestMP3 = samsung;
  258.  
  259.             int TestWybor;
  260.             string TestZmien;
  261.             int wybor;
  262.             do
  263.             {
  264.                 Console.WriteLine("Witaj w menu! Wybierz urzadzennie: 1. Komputer 2.Mp3 3. Testuj 4. Prezent 9.Zakończ");
  265.                 DokonajWyboru(out wybor);
  266.                 switch (wybor)
  267.                 {
  268.  
  269.                     case 1:
  270.                         do
  271.                         {
  272.                             laptop.Check();
  273.                             Console.WriteLine("Wybierz, co chcesz zrobic: 1.Wlacz komputer 2.Zmien 8.Wyjdz ");
  274.                             wybor = int.Parse(Console.ReadLine());
  275.                             switch (wybor)
  276.                             {
  277.                                 case 1:
  278.                                     laptop.Start();
  279.                                     break;
  280.                                 case 2:
  281.                                     laptop.Tryb();
  282.                                     break;
  283.                                 case 3:
  284.                                     break;
  285.                             }
  286.                         } while (wybor != 8);
  287.                 break;
  288.        
  289.                     case 2:
  290.                         do
  291.                         {
  292.                             samsung.Check();
  293.                             Console.WriteLine("Wybierz, co chcesz zrobić: 1. Włącz 2. Dokup losowe piosenki 7. Wyjdz");
  294.                             wybor = int.Parse(Console.ReadLine());
  295.                             switch (wybor)
  296.                             {
  297.                                 case 1:
  298.                                     samsung.Start();
  299.                                     break;
  300.                                 case 2:
  301.                                     samsung.Dokup();
  302.                                     break;
  303.                                 case 3:
  304.                                     break;
  305.                             }
  306.                         } while (wybor != 7);
  307.                         break;
  308.  
  309.                     case 3:
  310.                         Testuj(ref TestLaptop, ref TestMP3, out TestWybor, out TestZmien);
  311.                         Console.WriteLine("Nowe wartości komponentów testowych komputera: ");
  312.                         Console.WriteLine("Kolor: " + TestLaptop.colour);
  313.                         Console.WriteLine("Procesor: " + TestLaptop.processor);
  314.                         Console.WriteLine("Karta graficzna: " + TestLaptop.graphic);
  315.                         Console.WriteLine("Nowe wartości komponentów testowych Mp3: ");s
  316.                         Console.WriteLine("Ilość piosenek: " + TestMP3.songs);
  317.                         Console.WriteLine("Ilość pamięci: " + TestMP3.memory);
  318.                         Console.WriteLine("Nowa wartosc zmiennej wyboru: " + TestWybor);
  319.  
  320.  
  321.                         break;
  322.  
  323.                     case 4:
  324.                         Prezent(laptop, samsung);
  325.                         break;
  326.                 }
  327.             } while (wybor != 9);
  328.         }
  329.     }
  330. }
  331.