完成一个员工管理系统,主要功能有:新增员工,修改员工,删除员工,员工查找,数据统计

完成一个员工管理系统,主要功能有:新增员工,修改员工,删除员工,员工查找,数据统计。

功能为:

(1)员工个人信息有:工号(),姓名,性别,年龄,工资

(2)新增员工:新增一个员工到系统中去

(3)修改员工:可以修改员工工资

(4)删除员工:根据员工工号,从系统中删除该员工

(5)员工列表:显示所有员工的个人信息

(6)数据统计功能中,统计平均工资,最高工资,最低工资

Employees = [{"id":10000,"name":"terry","gender":"man","age":20,"wages":5000},{"id":10001,"name":"tom","gender":"girl","age":19,"wages":4500}]
print("员工的个人信息:%s"%Employees )
print("****************************")
print("1.新增员工**********************")
print("2.修改员工***********************")
print("3.删除员工***********************")
print("4.员工列表***********************")
print("5.统计信息***********************")
print("6.退出***************************")
print("*********************************")
select = int(input("请输入功能选项:"))
if select == 1:#新增一个
      id = int(input("请输入工号:"))
      name = input("请输入姓名:")
      gender = input("请输入性别:")
      age = int(input("请输入年龄:"))
      wages = int(input("请输入工资:"))
      oneEmployees = {"id": id, "name": name, "gender": gender, "age": age, "wages": wages}
      Employees.append(oneEmployees)
      print("恭喜,新增成功")
elif select == 2:
    updateid = int(input("请输入员工要修改的工号:"))
    for a in Employees:
        if(a["id"]) == updateid:
            a["wages"] = int(input("请输入新的工资;"))
            print("恭喜,修改成功")
            break
    else:
        print("未找到要修改的员工")
elif select == 3:
    delID = int(input("请输入需要删除的员工的工号:"))
    index = 0
    for oneDict in Employees :
        if (oneDict["id"]) == delID:
            Employees .pop(index)
            print("恭喜,删除成功!")
            break
            index += 1
        else:
            print("您输入的工号有误!")
elif select == 4:
    print("员工列表:%s"%Employees )
elif select == 5:
    sum = 0
    for one in Employees :
        aa = one["wages"]
        sum += aa
    print(sum)
    bb = 0
    for one in Employees :
        bb += 1
    Average = sum / bb
    print("平均工资为:", Average )
    a = len(Employees)
    if a>=2:
        x=Employees[0]
        y=x["wages"]
        p=Employees[1]
        a=p["wages"]
        if y>=a:
            print("最高%d"%y)
            print("最低%d"%a)
        else:
            print("最高工资为:%d" % y)
            print("最低工资为:%d" % y)
else:
    exit()

 

    原文作者:九师傅哩
    原文地址: https://blog.csdn.net/L_993959/article/details/116125282
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞