1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace WSUniversalLib
- {
- public class Calculation
- {
- public static int GetPriorityForAgent(int agentType, float age, float experience)
- {
- float[] agentKoef = { 0, 1.8F, 3.2F, 4.1F };
- float[] agentKoefYoung = { 0, 1.9F, 3.37F, 4.36F };
- float[] agentKoefOlder10 = { 0, 2.3F, 3.7F, 4.6F };
- float[] agentKoefOlder20 = { 0, 2.5F, 3.9F, 4.8F };
- float[] agentKoefOlder40 = { 0, 2.7F, 4.1F, 5.0F };
- int priority = 0;
- if (agentType <= 0 || age <= 0 || experience <= 0)
- {
- return -1;
- }
- if(age < 25 && experience < 3)
- {
- priority = Convert.ToInt32(Math.Round(experience* agentKoefYoung[agentType]));
- return priority;
- }
- if (experience >= 10 && experience < 20)
- {
- priority = Convert.ToInt32(Math.Round(experience * agentKoefOlder10[agentType]));
- return priority;
- }
- if (experience >= 20 && experience < 40)
- {
- priority = Convert.ToInt32(Math.Round(experience * agentKoefOlder20[agentType]));
- return priority;
- }
- if (experience >= 40)
- {
- priority = Convert.ToInt32(Math.Round(experience * agentKoefOlder40[agentType]));
- return priority;
- }
- else
- {
- priority = Convert.ToInt32(Math.Round(experience * agentKoef[agentType]));
- return priority;
- }
- }
- }
- }
|