コード例 #1
0
 def add_employee(self):
     nama_emp = input("masukkan nama : ")
     TL_emp = input("masukkan tanggal lahir : ")
     jabatan_emp = input("masukkan jabatan karyawan : ")
     JK_emp = input("masukkan jenis kelamin : ")
     alamat_emp = input("masukkan alamat : ")
     #Employee.Employee.list_employee.append(Employee.Employee(nama_emp, TL_emp, jabatan_emp, JK_emp, alamat_emp))
     if jabatan_emp == "Employee":
         Employee.Employee.list_employee.append(
             Employee.Employee(nama_emp, TL_emp, jabatan_emp, JK_emp,
                               alamat_emp))
     elif jabatan_emp == "Receptionist":
         Employee.Receptionist.list_employee.append(
             Employee.Receptionist(nama_emp, TL_emp, JK_emp, alamat_emp))
         Employee.Receptionist.list_receptionist.append(
             Employee.Receptionist(nama_emp, TL_emp, JK_emp, alamat_emp))
     elif jabatan_emp == "Marketing Crew":
         Employee.Marketing_crew.list_employee.append(
             Employee.Marketing_crew(nama_emp, TL_emp, JK_emp, alamat_emp))
         Employee.Marketing_crew.list_MC.append(
             Employee.Marketing_crew(nama_emp, TL_emp, JK_emp, alamat_emp))
     elif jabatan_emp == "Cashier":
         Employee.Cashier.list_employee.append(
             Employee.Cashier(nama_emp, TL_emp, JK_emp, alamat_emp))
         Employee.Cashier.list_cashier.append(
             Employee.Cashier(nama_emp, TL_emp, JK_emp, alamat_emp))
     else:
         Employee.Employee.list_employee.append(
             Employee.Employee(nama_emp, TL_emp, jabatan_emp, JK_emp,
                               alamat_emp))
コード例 #2
0
    def __init__(self, exp_chef_num: int, new_chef_num: int,
                 exp_cashier_num: int, new_cashier_num: int,
                 raw_material_cost: float):
        """
        An ice-cream shop requires information about
        - number of experienced and non-experienced chefs it has for a day (exp_chef_num, new_chef_num)
        - number of experienced and non-experienced cashiers it has for a day (exp_cashier_num, new_cashier_num)
        - ice-cream price for different sizes S, M and L (price_S, price_M, price_L)
        - the current amount of raw material to make ice-cream (raw_material_cost).
          We assume that 1 small ice-cream costs $1 of raw material, 1 medium ice-cream costs $1.5 of raw material,
          and 1 large ice-cream costs $2 of raw material based on unit equivalency among different sizes.
        - a check variable whether it has enough raw material (is_enough_raw_material)
        - list of chefs and cashiers it has (chef_list, cashier_list)
        - total number of ice-cream size S, M and L it has sold for the day (total_s_ic, total_m_ic, total_l_ic)
        - total number of ice-cream units it has sold for the day (total_ic_num)
        :param exp_chef_num: number of experienced chefs
        :param new_chef_num: number of non-experienced chefs
        :param exp_cashier_num: number of experienced cashiers
        :param new_cashier_num: number of non-experienced cashiers
        """
        self.price_S = 4
        self.price_M = 6
        self.price_L = 8
        self.raw_material_cost = raw_material_cost
        self.is_enough_raw_material = True
        self.chef_list, self.cashier_list = [], []
        self.total_s_ic = 0
        self.total_m_ic = 0
        self.total_l_ic = 0
        self.total_ic_num = 0

        for i in range(new_chef_num):
            self.chef_list.append(Employee.Chef(i + 1, is_experienced=False))
        for i in range(exp_chef_num):
            self.chef_list.append(
                Employee.Chef(new_chef_num + i + 1, is_experienced=True))
        for i in range(new_cashier_num):
            self.cashier_list.append(
                Employee.Cashier(i + 1, is_experienced=False))
        for i in range(exp_cashier_num):
            self.cashier_list.append(
                Employee.Cashier(new_cashier_num + i + 1, is_experienced=True))