oop - Python elevator simulation problem -


I have a homework assignment that is actually cooking my noodle, it includes a lift simulation, which is the number of floors and elevators Uses user input for the number of people using it. The initial floor of the people and the destination floor are random numbers within the floor.

I know that my code is very rare and that there are some flaws, but I do not know where to go from here.

I need help within the building class, such as Run () and how to do the output () section Any other suggestions would be greatly appreciated and note that I have someone code for me Do not see me, but how to hold my hand and tell me how to go to classes, I feel completely angry.

import random floors = raw_input ('S Enter the number of floors for simulation: ') While the floor Islafa () or floor.Space () or int (flooring) & lt; = 0: floor = raw_input ('Please enter a number for floor number' :) Customer = raw_input ('Please enter the number of customers in the building:'), while customers .isalpha () or customers.isspace () Or int (client) & lt; 0: customer = raw_input ('Please enter a digit for the number of subscribers'') counting = 1 class building: def num_of_floors (): num_of_floors = floor DRH customer_list (): customer_list = client def run (self): def Production (self): Print lift curve_flower class elevator: def num_of_floors (): building.num_of_floors def register_list (): register_list = [def] cur_floor (build): cur_floor = 1 def direction (self): if elevator cur_floor == 1: Direction = above if lift kur_flue == floor: direction = down trick (self): if lift direction == above: cur_floor + = 1 If lift direction == below: cur_floor - = 1def register_customer (auto, customer): Register_list.append (customer.ID) def cancel_customer (auto, customer): register_list.remove (customer.id) class customer: def cur_floor (customer) ): Cur_floor = random.randint (0, int) (), dst_floor (customer): dst_floor = random.randint (0, int) Floor)) def id (): cust_id = count count + = 1 def cust_dict (Cust_id, dst_floor): cust_dict = {cust_id: dst_floor} def in_elevator (): in_elevator = 0 if client.id regis Ter_list: in_elevator = 1 def Finish (): If customer.ID is not in register_list: pass

  • You must understand the self parameter for all the methods.
  • You have to understand __init __ , the constructor.
  • You need to understand self.varible for your member variable.
  • You have to understand how to setup a main function.
  • How do you define return by function or method.
  • You have to understand how to assign the global variable to the function or the method from within.

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -