Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.13 KB | None | 0 0
  1. class Ksiazka:
  2.    
  3.         '''
  4.        
  5.        Obiekt ksiazka opisuje wlasnosci ksiazek
  6.        
  7.        Args:
  8.        tytul(str)
  9.        autor(str)
  10.        rok_wydania(int)
  11.        oprawa(str)
  12.        ISBN(int)
  13.        cena(float)
  14.        kategoria(str)
  15.        wydawnictwo(str)
  16.        
  17.        
  18.        Attributes:
  19.        tytul:Zawiera informacje o tytule ksiazki
  20.        autor:Zawiera informacje o autorze
  21.        rok_wydania:Zawiera informacje o roku wydania
  22.        oprawa:zawiera informacje o oprawie
  23.        ISBN:Zawiera informacje o identyfikatorze książki
  24.        cena:Zawiera informacje o cenie ksiazki
  25.        kategoria:Zawiera informacje o kategorii ksiazki
  26.        wydawnictwo:Zawiera informacje o wydawnictwie ksiazki
  27.        '''
  28.        
  29.         def __init__(self,tytul,autor,rok_wydania,oprawa,ISBN,cena,kategoria,wydawnictwo):
  30.             self.tytul = tytul
  31.             self.autor = autor
  32.             self.rok_wydania = rok_wydania
  33.             self.oprawa = oprawa
  34.             self.ISBN = ISBN
  35.             self.cena = cena
  36.             self.kategoria = kategoria
  37.             self.wydawnictwo = wydawnictwo
  38.            
  39.  
  40.         def get_tytul(self):
  41.             return self.tytul
  42.  
  43.         def get_autor(self):
  44.             return autor.umaszczenie
  45.  
  46.         def get_rok_wydania(self):
  47.             return self.rok_wydania
  48.  
  49.         def get_oprawa(self):
  50.             return self.oprawa
  51.  
  52.         def get_ISBN(self):
  53.             return self.ISBN
  54.  
  55.         def get_cena(self):
  56.             return self.cena
  57.  
  58.         def get_kategoria(self):
  59.             return self.kategoria
  60.  
  61.         def get_wydawnictwo(self):
  62.             return self.wydawnictwo
  63.  
  64.  
  65.         def set_tytul(self, x):
  66.             if isinstance(x, str):
  67.                 self.tytul = x
  68.             else:
  69.                 raise TypeError("Marka powinna byc w typie STR")
  70.  
  71.         def set_autor(self, x):
  72.             if isinstance(x, str):
  73.                 self.autor = x
  74.             else:
  75.                 raise TypeError("Pojemnosc powinna byc w int")
  76.  
  77.         def set_rok_wydania(self, x):
  78.             if isinstance(x, str):
  79.                     self.rok_wydania = x
  80.             else:
  81.                 raise TypeError("Kolor powinien byc w str")
  82.  
  83.         def set_oprawa(self, x):
  84.             if isinstance(x, int):
  85.                     self.oprawa = x
  86.             else:
  87.                 raise TypeError("Kolor powinien byc w str")
  88.  
  89.         def set_ISBN(self, x):
  90.             if isinstance(x,int):
  91.                 self.ISBN = x
  92.         else:
  93.             raise TypeError("Zmienna powinna byc INT")
  94.  
  95.         def set_cena(self, x):
  96.             if isinstance(x,int):
  97.                 self.cena = x
  98.         else:
  99.             raise TypeError("Zmienna powinna byc INT")
  100.  
  101.  
  102.         def set_kategoria(self, x)
  103.             if isinstance(x,str):
  104.                 self.kategoria = x
  105.            
  106.         else:
  107.             raise TypeError("Zmienna powina byc STR")
  108.  
  109.         def set_wydawnictwo(self, x)
  110.             if isinstance(x,str):
  111.                 self.wydawnictwo = x
  112.         else:
  113.             raise TypeError("Zmienna pwinna byc STR")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement