Skip to content
Snippets Groups Projects
Commit 0bdf50b5 authored by Antoine Félix's avatar Antoine Félix
Browse files

Préparation des dépendances et ajout d'une version portable.

parent 76317bc5
Branches
No related merge requests found
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace psychorientation
{
class Config
{
private static Config instance;
public double coeffEffortOral;
public double coeffCompetenceOral;
public double coeffCompetenceEcrit;
public double coeffEffortEcrit;
public static Config GetInstance()
{
if (Config.instance == null)
{
Config.instance = JsonConvert.DeserializeObject<Config>(File.ReadAllText("config.json"));
return Config.instance;
}
else
{
return Config.instance;
}
}
public double GetCoeffEffortOral()
{
return this.coeffEffortOral;
}
public double GetCoeffCompetenceOral()
{
return this.coeffCompetenceOral;
}
public double GetCoeffCompetenceEcrit()
{
return this.coeffCompetenceEcrit;
}
public double GetCoeffEffortEcrit()
{
return this.coeffEffortEcrit;
}
}
}
......@@ -25,7 +25,7 @@ namespace psychorientation
this.competence = Eleve.r.NextDouble()*10;
this.effort = Eleve.r.NextDouble()*10;
this.orientation = 0;
this.appreciation=CalculerAppreciation();
this.appreciation=CalculerAppreciation(1);
}
public Eleve(int id,int classe, double competence, double effort, int orientation)
......@@ -35,7 +35,7 @@ namespace psychorientation
this.competence = competence;
this.effort = effort;
this.orientation = orientation;
this.appreciation = CalculerAppreciation();
this.appreciation = CalculerAppreciation(1);
}
public void SetClasse(int classe)
{
......@@ -161,9 +161,9 @@ namespace psychorientation
return (this.effort * (2 - coeff) + this.competence * coeff);
}
private double CalculerAppreciation()
private double CalculerAppreciation(double coeff)
{
return (this.effort * Config.GetInstance().GetCoeffEffortOral() + this.competence * Config.GetInstance().GetCoeffCompetenceOral());
return (this.effort * (2 - coeff) + this.competence * coeff);
}
}
}
......@@ -50,7 +50,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="Eleve.cs" />
<Compile Include="InterfaceClasse.cs">
<SubType>Form</SubType>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment