Job Code: Https://coding.net/u/liyi175/p/Dianti/git
Partner member: Leigh Http://home.cnblogs.com/u/Yililove/
For this assignment, I just started a little thought, after the teacher arranged to close the partner Leigh, my partner asked me, what programming language we need to write programs, I think about it, freshman to junior, we learned C, C + + in these two languages, and C started to give up decisively, because unable to do interface, c+ + also feel not reliable, although can do interface, but too troublesome, also hope not on. After entering the junior, I have taken Java, self-taught Android, and Leigh also self-taught Java, so use Java to write elevator this job hit it off. Of course, in this process encountered a lot of problems, because we are self-taught, Java programming ideas, logical structure naturally not like C so understand, such as some library functions, functions of encapsulation and so on ...
According to the project requirements, a building has four elevators, a total of 21 floors, and according to the requirements, the first to fourth elevator can reach all floors, the second elevator can go to a single floor, the third elevator can reach the double-storey building, the project in Java set up six class, the first class of course first write interface class, Then write the first to the fourth elevator class, and a show class, such as 6 classes. To be sure, there are still a lot of functions in these categories, here do not show, for beginners Java, for the first time to write such a large project, I am too much to say.
For this project, using Java programming will naturally make the interface more attractive, saving the necessary text description and unnecessary trouble in programming, in order to simulate the elevator interface: the interface of the simulation elevator not only has the external button and the elevator interior button, the external button can make the elevator reach the passenger floor, While the internal button allows passengers to go to the floor, if the passenger is on the floor of a single-storey or double-decker elevator and elevator fourth is running randomly, when the passenger in the double-decker when the third elevator in operation, if the first elevator and 4th elevator at the same time, elevator 3rd, when the passenger in the double-decker, And the elevator and elevator 4th are running at the same time, Elevator No. 2nd started. This involves the use of the thread scheduler to run.
In fact, in this process, we encountered a lot of trouble, in front of Java we appear relatively small, in the face of time we appear more vicissitudes, due to the time and ability of the problem, the project is not so perfect, does not reflect all the requirements of the project, such as whether the elevator is overweight, The number of bearer and so on this program does not reflect, because in the Java container, thread internal and so on, we have no way to solve.
This is a single-layer running program:
This is a double-run program:
Because of the various classes, not described here, let's take a look at the preparation of an elevator:
The red arrow is the door open and the judge is overweight, because of the ability and time problems, and not very perfect, but we believe that after we further contact with Java, these problems are not problems, and we now realize the importance of Java in the IT industry, how dare ignore java. The piece is a part of the code of the elevator operation:
Here's how to run the program: you can see that the lift starts at the floor where it can be reached.
The following is the operation of the program: when the 19-layer response, fourth elevator random operation, 16-layer response, 4th elevator is still in operation, the start of elevator 1th operation, in the operation of the elevator 1, 4th, if the single-layer response, the operation of elevator 2nd, double response, 2nd elevator operation.
Summary: Through this project, aware of the importance of pairing programming, as well as the lack of knowledge in the process of doing the project, due to the lack of their own ability, in the process of pairing programming, they can not be entrusted with large, but the partner ability is too strong, oneself can learn humbly, promote oneself to do better, Play a bigger role in the next project, and more importantly, let yourself feel and discover your weaknesses, and let yourself be full of anticipation and love for pairing programming!
Java-written elevator simulation system "pair operation"