-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
48 lines (33 loc) · 1.52 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
"""
Created on
@author: dmitr
"""
class Employee:
vacation_days = 28
def __init__(self, first_name, second_name, gender):
self.first_name = first_name
self.second_name = second_name
self.gender = gender
self.remaining_vacation_days = Employee.vacation_days
def consume_vacation(self, days):
self.remaining_vacation_days -= days
def get_vacation_details(self):
return f'Остаток отпускных дней: {self.remaining_vacation_days}.'
class FullTimeEmployee(Employee):
def __init__(self, first_name, second_name, gender):
super().__init__(first_name, second_name, gender)
def get_unpaid_vacation(self, start_date, days):
print(f'Начало неоплачиваемого отпуска: {start_date}, продолжительность: {days} дней.')
return
class PartTimeEmployee(Employee):
vacation_days = 14
def __init__(self, first_name, second_name, gender):
super().__init__(first_name, second_name, gender)
self.remaining_vacation_days = self.vacation_days
# Расширьте класс Employee, создав классы FullTimeEmployee и PartTimeEmployee.
# Пример использования:
full_time_employee = FullTimeEmployee('Роберт', 'Крузо', 'м')
print(full_time_employee.get_unpaid_vacation('2023-07-01', 5))
part_time_employee = PartTimeEmployee('Алёна', 'Пятницкая', 'ж')
print(part_time_employee.get_vacation_details())