Facebook
From Innocent Zebra, 8 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 369
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.         }
  14.     }
  15.  
  16.    
  17.     class Samochod
  18.     {
  19.         int ilosc;
  20.        
  21.         string marka, numer;
  22.         int pojemnosc, przebieg;
  23.         int spalanie {get; set;}
  24.        
  25.         static Samochod(){
  26.             ilosc = 0;
  27.         }
  28.        
  29.         public Samochod()
  30.         {
  31.             ilosc++;
  32.         }
  33.        
  34.         public Samochod(string marka, string numer, int pojemnosc, int przebieg, int spalanie) : this()
  35.         {
  36.             this.marka = marka;
  37.             this.numer = numer;
  38.             this.pojemnosc = pojemnosc;
  39.             this.przebieg = przebieg;
  40.             this.spalanie = spalanie;
  41.         }
  42.        
  43.         public Samochod (Samochod s) : this()
  44.         {
  45.             marka = s.marka;
  46.             numer = s.numer;
  47.             pojemnosc = s.pojemnosc;
  48.             przebieg = s.przebieg;
  49.             spalanie = s.spalanie;
  50.         }
  51.        
  52.         public void aktualizuj_przebieg(int przejechano){
  53.             przebieg += przejechano;
  54.         }
  55.        
  56.         public int ile_benzyny(int odleglosc){
  57.             return odleglosc*spalanie;
  58.         }
  59.        
  60.         public void Info(){
  61.             Console.WriteLine("{0}, nr. {1}, pojemnosc {2}, przebieg {3}, spalanie {4}", marka, numer, pojemnosc, przebieg, spalanie); 
  62.         }
  63.            
  64.     }
  65. }