Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication41
- {
- class Adres {
- private string kod, miasto, ulica;
- public Adres(string kod, string miasto, string ulica)
- {
- this.kod = kod;
- this.miasto = miasto;
- this.ulica = ulica;
- }
- public string get_kod() { return kod;}
- public string get_miasto() { return miasto;}
- public string get_ulica() { return ulica; }
- }
- class Osoba
- {
- private Adres a;
- private string imie, nazwisko, PESEL;
- public Osoba(Adres a,string imie, string nazwisko, string PESEL)
- {
- this.a = a;
- this.imie = imie;
- this.nazwisko = nazwisko;
- this.PESEL = PESEL;
- }
- public string get_imie() { return imie; }
- public string get_nazwisko() { return nazwisko; }
- public string get_PESEL() { return PESEL; }
- public string get_kod() { return a.get_kod(); }
- public string get_miasto() { return a.get_miasto(); }
- }
- class Kartoteka
- {
- private List<Osoba> l;
- public Kartoteka() { l = new List<Osoba>(); }
- public void dodaj(Osoba o) { l.Add(o); }
- public bool usun(Osoba o) { return l.Remove(o); }
- public void wyszukaj(Osoba o)
- {
- Console.WriteLine("Podaj Kod");
- string p = Console.ReadLine();
- Console.WriteLine("Podaj PESEL");
- string pes = Console.ReadLine();
- if (p == o.get_kod() && pes==o.get_PESEL()) Console.WriteLine("ZAWIERA");
- else Console.WriteLine("Nie zawiera");
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Kartoteka k = new Kartoteka();
- Adres a = new Adres("16100", "Sokółka", "Polna");
- Osoba o = new Osoba(a,"Łukasz", "Bagan", "PESEL");
- k.dodaj(o);
- k.wyszukaj(o);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement