
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package konsolowa;

/*
******************************************************
    nazwa klasy: Film
    pola: liczbaWypozyczen - przechowuje liczbe wypozyczen filmu
          tytul - przechowuje tytul filmu
    metody: setLiczbaWypozyczen, void – nadaje liczbe wypozyczen filmu
            setTytul, void – nadaje tytul filmu
            getLiczbaWypozyczen, int - zwraca liczbe wypozyczen filmu
            getTytul, String - zwraca tytul filmu
            wypozycz, void - zwiększa liczbe wypozyczen o 1
    informacje: jest to klasa o nazwie Film która przechowuje dane takie jak: liczbaWypozyczen i tytul
    autor: 312312321
*****************************************************
*/

public class Film {
    protected int liczbaWypozyczen;
    protected String tytul;
    
    public Film() {
        liczbaWypozyczen = 0;
        tytul = "";
    }
    
    public void setLiczbaWypozyczen(int _liczbaWypozyczen) {
        liczbaWypozyczen = _liczbaWypozyczen;
    }
    
    public void setTytul(String _tytul) {
        tytul = "";
        if(_tytul.length() > 20) {
            for(int i=0; i<20; i++) {
              tytul += _tytul.charAt(i);
            }
        } else {
            for(int i=0; i<_tytul.length(); i++) {
                tytul += _tytul.charAt(i);
            }
        }
    }
    
    public int getLiczbaWypozyczen() {
        return liczbaWypozyczen;
    }
    
    public String getTytul() {
        return tytul;
    }
    
    public void wypozycz() {
        liczbaWypozyczen++;
    }
}
