Переглянути джерело

Функция для тестирования

Barsik Kato 2 роки тому
батько
коміт
c5fdaec164

+ 48 - 1
WSUniversalLib/Class1.cs

@@ -8,6 +8,53 @@ namespace WSUniversalLib
 {
     public class Calculation
     {
-
+        public int GetPriorityForAgent(int agentType, float age, float experience)
+        {
+            float x;
+            switch(agentType)
+            {
+                case 1:
+                    x = 1.8f;
+                    break;
+                case 2:
+                    x = 3.2f;
+                    break;
+                case 3:
+                    x = 4.1f;
+                    break;
+                default:
+                    return -1;
+            }
+            if(experience > 10)
+            {
+                x += 0.5f;
+            }
+            else if (experience > 20)
+            {
+                x += 0.7f;
+            }
+            else if (experience > 40)
+            {
+                x += 0.9f;
+            }
+            if (age <= 25 && experience <= 3)
+            {
+                switch (agentType)
+                {
+                    case 1:
+                        x += 0.1f;
+                        break;
+                    case 2:
+                        x += 0.17f;
+                        break;
+                    case 3:
+                        x += 0.26f;
+                        break;
+                    default:
+                        return -1;
+                }
+            }
+            return (int)x;
+        }
     }
 }

+ 14 - 17
WSUniversalLib/WSUniversalLib.csproj

@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>093d768a-6a7a-47bb-90ac-d3f223393811</ProjectGuid>
+    <ProjectGuid>{093D768A-6A7A-47BB-90AC-D3F223393811}</ProjectGuid>
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>WSUniversalLib</RootNamespace>
@@ -31,24 +31,21 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="System"/>
-    
-    <Reference Include="System.Core"/>
-    <Reference Include="System.Xml.Linq"/>
-    <Reference Include="System.Data.DataSetExtensions"/>
-    
-    
-    <Reference Include="Microsoft.CSharp"/>
-    
-    <Reference Include="System.Data"/>
-    
-    <Reference Include="System.Net.Http"/>
-    
-    <Reference Include="System.Xml"/>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Class1.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="WSUniversalLib.dll" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- </Project>
+</Project>

BIN
WSUniversalLib/WSUniversalLib.dll