高校工资管理系统代码
时间: 2024-02-18 22:57:19 浏览: 56
根据提供的引用内容,以下是一个简单的高校工资管理系统的代码示例:
```python
class Teacher:
def __init__(self, name, salary, id, gender, age, phone):
self.name = name
self.salary = salary
self.id = id
self.gender = gender
self.age = age
self.phone = phone
def display_info(self):
print("Name:", self.name)
print("Salary:", self.salary)
print("ID:", self.id)
print("Gender:", self.gender)
print("Age:", self.age)
print("Phone:", self.phone)
def main():
teachers = []
# 添加教师信息
teacher1 = Teacher("John", 5000, "T001", "Male", 35, "1234567890")
teacher2 = Teacher("Alice", 6000, "T002", "Female", 40, "9876543210")
teachers.append(teacher1)
teachers.append(teacher2)
# 显示所有教师信息
for teacher in teachers:
teacher.display_info()
if __name__ == "__main__":
main()
```
这段代码定义了一个`Teacher`类,用于表示教师的相关信息。在`main`函数中,我们创建了两个教师对象,并将它们添加到`teachers`列表中。然后,我们遍历`teachers`列表,调用`display_info`方法显示每个教师的信息。
阅读全文