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.IO;
- namespace Lab1
- {
- public class samochod
- {
- int predkosc;
- string model, marka, rejestracja;
- kierowca[] auto = new kierowca[4];
- public samochod(int a, string b, string c, string d)
- {
- predkosc = a;
- model = b;
- marka = c;
- rejestracja = d;
- }
- public void dodajDoAuta(kierowca k, int miejsce)
- {
- auto[miejsce] = k;
- }
- public void wypisz(int miejsce)
- {
- kierowca k = auto[miejsce];
- Console.WriteLine("Prędkość maksymalna: " + predkosc + "km/h " + "Model: " + model + " " + "Marka: " + marka + " " + "Rejestracja: " + rejestracja);
- }
- public void wypiszKierowce(int miejsce)
- {
- kierowca k = auto[miejsce];
- Console.WriteLine(k.GetImie() + " " + k.GetNazwisko());
- }
- }
- public class kierowca
- {
- string imie, nazwisko;
- public kierowca(string a, string b)
- {
- imie = a;
- nazwisko = b;
- }
- public string GetImie()
- {
- return imie;
- }
- public string GetNazwisko() {
- return nazwisko;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- samochod s1 = new samochod(170, "Fiat", "Panda", "LB48469");
- kierowca k1 = new kierowca("Zbigniew", "Iwaniuk");
- kierowca k2 = new kierowca("Ola", "Nowak");
- s1.dodajDoAuta(k1, 1);
- s1.dodajDoAuta(k2, 2);
- s1.wypiszKierowce(1);
- s1.wypiszKierowce(2);
- s1.wypisz(1);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement