Bank business Dispatch System-experience 1-Project requirements analysis and Class diagram architecture

Source: Internet
Author: User

1. Project requirements of the banking dispatch system

Simulation to achieve the logic of banking scheduling system, the specific requirements are as follows:

Ø There are 6 business windows in the Bank, window 1-4 is a normal window, window 5th is a quick window, and 6th window is the VIP window.

Ø There are three types of customers: VIP customers, ordinary customers, fast customers (handling such as electricity and water charges, such as customer service charges).

Ø randomly generate various types of customers, the probability of generating various types of users is:

VIP Customers: Ordinary customers: Fast customer = 1:6:3.

Ø the customer needs to handle the business time has the maximum and the minimum value, in this range randomly sets each VIP customer as well as the ordinary customer handles the business time, the fast customer handles the business the time to be minimum value (hint: the process of handling the business can be simulated by thread sleep way).

Ø various types of customers in their corresponding windows in order to transact business.

Ø when the VIP (number 6th) window and Fast Service (5th) window does not have customers waiting for business, these two windows can handle the business of ordinary customers, and once the corresponding customer waiting for business, then priority to deal with the business of the corresponding customer.

Ø randomly generate customer time interval and business processing time maximum and minimum custom, you can set.

Ø does not require the implementation of the GUI, only consider the system logic implementation, can display the results of the program log.

2. Object-oriented analysis and design

L have three types of customers: VIP customers, ordinary customers, fast customers, asynchronous random generation of various types of customers, all types of customers in their corresponding window in order to transact business.

Ø first of all, often in the banking business people are more conducive to understanding the system, know that each customer is actually a bank of the number of a machine to generate numbers in the way to express. So, I think to have a number manager object, let this object constantly generate numbers, is equal to randomly generated customers.

Ø because there are three types of customers, each type of customer number arrangement is completely independent, so, I think this system will produce three number manager object, each manage a type of user's queue number. These three number manager objects are uniformly managed by a number machine, which can always have one in the entire system, so it is designed to be a single example.

L Various types of customers in their corresponding window in order to transact business, to be exact, the window should be called successively.

o how each window knows which number to call it. It must be asked the corresponding number manager, that is, the service window each time to find the number manager to get the number currently to be serviced.

Object-oriented design grasps an important experience: Who owns the data, and who provides the means to manipulate the data . A few typical cases can be firmly mastered: train drivers emergency brakes, people close the door and so on. The driver braked this process urgently, the object is not the driver but the train, the driver only operates the train, the actual internal or by the train braking system to force the train to stop; people close the door instead of people, imagine if the door does not have a rotating shaft you can not shut it, or the process of the encounter obstacles you can not shut it.

3. Class Diagram

Drawing is very helpful in understanding and analyzing problems, do you have a better way to do it than paint?

This system mainly uses above three classes: is the number machine, the number management pair, the service window, the system operation process may also need other class to do the auxiliary, these are the something, after the concrete preparation time to mention.

Numbermachine: Take the number machine, which uses the single case mode to face the customer getinstance (), which encapsulates the ordinary customer Getcommonmanager (), Fast customer Getexpressmanager () And the VIP Customer Getvipmanager () corresponding method;

Numbermanager: Number management objects, including the generation number Generatenumber () and the crawl number Fetchnumber () two ways.

Servicewindow: Service window, including method Start () for customer-initiated business, and three kinds of customer corresponding methods, no longer repeat.

4. The main type of the system to be written

L Numbermanager class

L defines a member variable for storing the last customer number and a collection of queues for storing all customer numbers waiting for the service.

L Define a method for generating a new number and the number to be serviced immediately, and the two methods are manipulated by different threads to the same data, so synchronize.

L Numbermachine class

L define three member variables to point to three Numbermanager objects, representing common, fast and VIP customer number managers, and define three corresponding methods to return the three Numbermanager objects.

L DESIGN the Numbermachine class as a single example.

L CustomerType Enumeration class

L There are three types of customers in the system, so define an enumeration class that defines three members representing three types of customers.

L Rewrite the ToString method to return the Chinese name of the type. This was reconstructed at the back of the code, and was not considered at first.

L Servicewindow class

L Define a Start method, start a thread internally, and loop through three different methods according to the category of the service window.

L define three methods to service three kinds of customers, in order to observe the operation effect, should print out the details of the detailed information.

L MainClass class

L Create 4 normal windows with a for loop, then create 1 quick windows and a VIP window.

L then create three timers to create a new regular customer number, a new quick customer number, and a new VIP customer number, respectively.

L Constants Class

L defines three constants: Max_service_time, Min_service_time, Common_customer_interval_time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.