-
Notifications
You must be signed in to change notification settings - Fork 0
/
slip18B.py
30 lines (26 loc) · 1.11 KB
/
slip18B.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
class Person:
def __init__(self, name, address):
self.name = name
self.address = address
class Employee(Person):
def __init__(self, name, address, staffed_salary):
super().__init__(name, address)
self.staffed_salary = staffed_salary
# Function to create 'n' Employee objects and display their details
def create_and_display_employees(n):
employees = []
for i in range(n):
name = input(f"Enter name of Employee {i + 1}: ")
address = input(f"Enter address of Employee {i + 1}: ")
staffed_salary = float(input(f"Enter staffed salary of Employee {i + 1}: "))
employee = Employee(name, address, staffed_salary)
employees.append(employee)
print("\nEmployee Details:")
for i, employee in enumerate(employees):
print(f"\nEmployee {i + 1}:")
print(f"Name: {employee.name}")
print(f"Address: {employee.address}")
print(f"Staffed Salary: {employee.staffed_salary}")
# Input for the number of employees
n = int(input("Enter the number of employees: "))
create_and_display_employees(n)