using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp20
{
class Program
{
public static void Main(string[] args)
{
List<Nocleg> noclegsList = new List<Nocleg>();
noclegsList.Add(new Pensjonat("1", 10, 1300, "drogo"));
noclegsList.Add(new Hotel("2", 10, 2000, 5));
noclegsList.Add(new Motel("3", 10, 800, false, true));
Console.WriteLine("Podaj nazwe noclegu : ");
string nazwa = Convert.ToString(Console.ReadLine());
for (int i = 0; i < noclegsList.Count; i++)
{
if (nazwa == noclegsList[i].Nazwa)
{
Console.WriteLine("Nazwa : " + noclegsList[i].Nazwa + "\nIloscMiejsc: " + noclegsList[i].IloscMiejsc + "\nCena: " + noclegsList[i].Cena);
}
}
Console.ReadKey();
}
}
abstract class Nocleg
{
public Nocleg()
{
this.Nazwa = "";
this.IloscMiejsc = 0;
this.Cena = 0;
}
public Nocleg(string nazwa, int iloscmiejsc, int cena)
{
this.Nazwa = nazwa;
this.IloscMiejsc = iloscmiejsc;
this.Cena = cena;
}
public string Nazwa
{
get;
protected set;
}
public int IloscMiejsc
{
get;
protected set;
}
public int Cena
{
get;
protected set;
}
}
class Hotel : Nocleg
{
public Hotel() : base()
{
this.Gwiazdki = 0;
}
public Hotel(string nazwa, int iloscmiejsc, int cena, int gwiazdki) : base(nazwa, iloscmiejsc, cena)
{
this.Gwiazdki = gwiazdki;
}
public int Gwiazdki
{
get;
protected set;
}
}
class Pensjonat : Nocleg
{
public Pensjonat()
{
this.OpisTurystyczny = "";
}
public Pensjonat(string nazwa, int iloscmiejsc, int cena, string opisturystyczny) : base(nazwa, iloscmiejsc, cena)
{
this.OpisTurystyczny = opisturystyczny;
}
public string OpisTurystyczny
{
get;
protected set;
}
}
class Motel : Nocleg
{
public Motel() : base()
{
this.WspolnaLazienka = false;
this.Sniadanie = false;
}
public Motel(string nazwa, int iloscmiejsc, int cena, bool sniadanie, bool wspolnalazienka) : base(nazwa, iloscmiejsc, cena)
{
this.Sniadanie = sniadanie;
this.WspolnaLazienka = wspolnalazienka;
}
public bool WspolnaLazienka
{
get;
protected set;
}
public bool Sniadanie
{
get;
protected set;
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}