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;
- namespace Biblioteka
- {
- class Wykonawcy {
- private string imie_nazwisko;
- public Wykonawcy(string arg)
- {
- imie_nazwisko = arg;
- }
- }
- class Utwor {
- private string tytul;
- private int dlugosc;
- private string wykonawca;
- public Utwor(string tyt, int dlug, string wyk)
- {
- tytul = tyt;
- dlugosc = dlug;
- wykonawca = wyk;
- }
- public string Wyswietl()
- {
- return tytul + ", " + dlugosc + ", " + wykonawca;
- }
- public int PodajDlugosc()
- {
- return dlugosc;
- }
- }
- class Plyta
- {
- private string tytul;
- private string typ;
- private List<Utwor> utwory = new List<Utwor>{};
- public Plyta(string arg1, string arg2)
- {
- tytul = arg1;
- typ = arg2;
- }
- public override string ToString()
- {
- return tytul;
- }
- public void DodajUtwor(Utwor utwor) {
- utwory.Add(utwor);
- }
- public int PodajCzas()
- {
- int suma = 0;
- foreach (var item in utwory)
- {
- suma += item.PodajDlugosc();
- }
- return suma;
- }
- public void PokazUtwory()
- {
- Console.WriteLine(" Tytul: " + tytul);
- Console.WriteLine(" Czas trwania: " + this.PodajCzas()/60 + " minuty");
- Console.WriteLine(" Typ: " + typ);
- Console.WriteLine(" Utwory (nr, tytuł, czas trwania, wykonawca)\n");
- if (utwory.Count == 0)
- {
- Console.WriteLine(" Brak utworów na tej płycie");
- }
- int licznik = 1;
- foreach (var item in utwory)
- {
- Console.WriteLine(" "+licznik + ". "+item.Wyswietl());
- licznik++;
- }
- }
- }
- class Funkcje
- {
- public static bool Sprawdz(string arg) {
- if (arg == "0")
- return false;
- else
- return true;
- }
- public static bool SprawdzInt(int arg)
- {
- if (arg == 0)
- return false;
- else
- return true;
- }
- }
- }
Add Comment
Please, Sign In to add comment