Facebook
From Coral Kangaroo, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 211
  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.     class Mp3
  10.     {
  11.         public bool stan;
  12.         public bool battery;
  13.         public int songs;
  14.         public int memory;
  15.         public int elektrycity;
  16.  
  17.         public Mp3()
  18.         {
  19.             stan = false;
  20.             battery = true;
  21.             songs = 666;
  22.             memory = 1024;
  23.             elektrycity = 0;
  24.         }
  25.  
  26.         public int WSongs
  27.         {
  28.             get
  29.             {
  30.                 return songs;
  31.             }
  32.             set
  33.             {
  34.                 songs = value;
  35.             }
  36.         }
  37.  
  38.         public int WMemory
  39.         {
  40.             get
  41.             {
  42.                 return memory;
  43.             }
  44.             set
  45.             {
  46.                 memory = value;
  47.             }
  48.         }
  49.  
  50.         public void Start()
  51.         {
  52.             if (stan)
  53.             {
  54.                 stan = false;
  55.                 elektrycity = 0;
  56.             }
  57.             else
  58.             {
  59.                 stan = true;
  60.                 elektrycity = 20;
  61.             }
  62.         }
  63.  
  64.         public void Check()
  65.         {
  66.             if (stan && battery)
  67.             {
  68.                 Console.WriteLine("Urzadzenie jest wlaczone!");
  69.             }
  70.             else
  71.             {
  72.                 Console.WriteLine("Urzadzenie jest wylaczone!");
  73.             }
  74.             if (battery)
  75.             {
  76.                 Console.WriteLine("Baterie sa wlozone!");
  77.             }
  78.             else
  79.             {
  80.                 Console.WriteLine("Brak bateri!");
  81.             }
  82.             Console.WriteLine("W pamieci jest: " + songs);
  83.             Console.WriteLine("Pamiec wynosi: " + memory);
  84.         }
  85.  
  86.         public int WElektrycity
  87.         {
  88.             set
  89.             {
  90.                 elektrycity = value;
  91.             }
  92.         }
  93.  
  94.         public void Dokup()
  95.         {
  96.             Console.WriteLine("Ile losowych piosenek chcesz dokupić?");
  97.             int x = 0;
  98.             x = int.Parse(Console.ReadLine());
  99.             Console.WriteLine("Dokupiono " + x + " nowych piosenek! Miłego słuchania!");
  100.             songs = songs + x;
  101.         }
  102.  
  103.         public Mp3(Mp3 x)
  104.         {
  105.             this.stan = x.stan;
  106.             this.battery = x.battery;
  107.             this.songs = x.songs;
  108.             this.memory = x.memory;
  109.         }
  110.  
  111.         private void Boost()
  112.         {
  113.             memory += 2048;
  114.         }
  115.  
  116.         public static Mp3 operator +(Mp3 lx, Mp3 rx)
  117.         {
  118.             Mp3 C = new Mp3();
  119.             C.songs = lx.songs + rx.songs;
  120.             C.memory = lx.memory + rx.memory;
  121.             return C;
  122.         }
  123.  
  124.         public static bool operator <(Mp3 lx, Mp3 rx)
  125.         {
  126.             return (lx.elektrycity < rx.elektrycity);
  127.         }
  128.         public static bool operator >(Mp3 lx, Mp3 rx)
  129.         {
  130.             return (lx.elektrycity > rx.elektrycity);
  131.         }
  132.     }
  133. }
  134.