Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. class Osoba:
  2.  
  3. def __init__(self, imie, nazwisko, pesel, rok_urodzenia, plec):
  4. self.imie = imie
  5. self.nazwisko = nazwisko
  6. if len(pesel) != 11:
  7. self.pesel = None
  8. else:
  9. self.pesel = pesel
  10. self.rok_urodzenia = rok_urodzenia
  11. self.plec = plec
  12.  
  13. def wyswielt_o(self):
  14. print(self.imie)
  15. print(self.nazwisko)
  16. print(self.pesel)
  17. print(self.rok_urodzenia)
  18. print(self.plec)
  19.  
  20.  
  21.  
  22.  
  23. class Student(Osoba):
  24.  
  25. def __init__(self, imie, nazwisko, pesel, rok_urodzenia, plec, numer_ind):
  26. super().__init__(imie, nazwisko, pesel, rok_urodzenia, plec)
  27. self.numer_indeksu = numer_ind
  28.  
  29.  
  30. def wyswietl_s(self):
  31. print("Imie i nazwisko: ", self.imie, self.nazwisko,
  32. "\nPesel: ", self.pesel, "\nRok urodzenia i płeć: ",
  33. self.rok_urodzenia, self.plec, "\nNumer Indeksu: ", self.numer_indeksu)
  34.  
  35.  
  36.  
  37. class Wykladowca(Osoba):
  38.  
  39. def __init__(self, imie, nazwisko, pesel, rok_urodzenia, plec, tytul):
  40. super().__init__(imie, nazwisko, pesel, rok_urodzenia, plec)
  41. self.tytul_naukowy = tytul
  42.  
  43.  
  44. def wyswietl_w(self):
  45. print("Imie i nazwisko: ", self.imie, self.nazwisko,
  46. "\nPesel: ", self.pesel, "\nRok urodzenia i płeć: ",
  47. self.rok_urodzenia, self.plec, "\nTytuł Naukowy: ", self.tytul_naukowy)
  48.  
  49.  
  50.  
  51.  
  52. class Stypendysta(Student):
  53.  
  54. def __init__(self, imie, nazwisko, pesel, rok_urodzenia, plec, numer_1, kwota):
  55. super().__init__(imie, nazwisko, pesel, rok_urodzenia, plec, numer_1)
  56. self.kwota_stypendium = kwota
  57.  
  58. def wyswietl_styp(self):
  59. print("Imie i nazwisko: ", self.imie, self.nazwisko,
  60. "\nPesel: ", self.pesel, "\nRok urodzenia i płeć: ",
  61. self.rok_urodzenia, self.plec, "\nNumer Indeksu: ", self.numer_indeksu,
  62. "\nKwota stypendium: ", kwota, "zł")
  63.  
  64.  
  65.  
  66. kwota = int(input("Wprowadź kwotę stypendium "))
  67. #tytul = str(input("Wprowadź swój tytuł naukowy "))
  68. numer_ind = int(input("Wprowadz numer indeksu "))
  69. obiekt = Stypendysta("Adam", "Martyniak", "15893857228", 2000, "Mężczyza", numer_ind, kwota)
  70. obiekt.wyswietl_styp()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement