Major release

This commit is contained in:
2022-11-12 19:02:52 +01:00
parent cca140f6d7
commit b09dfcb7be
18 changed files with 985 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
add_library(TopTeamBedrijfssimulaties "")
target_include_directories(TopTeamBedrijfssimulaties
PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)
add_subdirectory(Starters)

View File

@@ -0,0 +1,10 @@
target_sources(TopTeamBedrijfssimulaties
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/Starters.cpp
PUBLIC
${CMAKE_CURRENT_LIST_DIR}/Starters.cpp
)
target_include_directories(TopTeamBedrijfssimulaties
PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)

View File

@@ -0,0 +1,539 @@
#include "Starters.hpp"
Starters_c::Starters_c(MachineStandaard standaard, unsigned int jaarproductieMachine1,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame)
: Starters_c(standaard, 1, jaarproductieMachine1, 0, 0, verkoopprijs, winstmargeWinkel, kwaliteit, reclame)
{
}
Starters_c::Starters_c(MachineStandaard standaard, unsigned int jaarproductieMachine1,
unsigned int jaarproductieMachine2,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame)
: Starters_c(standaard, 2, jaarproductieMachine1, jaarproductieMachine2, 0, verkoopprijs, winstmargeWinkel, kwaliteit, reclame)
{
}
Starters_c::Starters_c(MachineStandaard standaard, unsigned int aantalMachines, unsigned int jaarproductieMachine1,
unsigned int jaarproductieMachine2, unsigned int jaarproductieMachine3,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame)
{
if (checkInput(standaard, aantalMachines, jaarproductieMachine1,
jaarproductieMachine2, jaarproductieMachine3, verkoopprijs,
winstmargeWinkel, kwaliteit, reclame) == false)
{
throw "Starters_c::Starters_c Invalid input";
}
this->standaard = standaard;
this->A1 = aantalMachines;
this->A2 = jaarproductieMachine1;
this->A5 = jaarproductieMachine2;
this->A8 = jaarproductieMachine3;
this->B1 = verkoopprijs;
this->B2 = winstmargeWinkel;
this->B3 = kwaliteit;
this->B4 = reclame;
}
bool Starters_c::checkInput(MachineStandaard standaard, unsigned int aantalMachines, unsigned int jaarproductieMachine1,
unsigned int jaarproductieMachine2, unsigned int jaarproductieMachine3,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame)
{
bool returnValue = true;
if (standaard == MachineStandaard::Standaard)
{
if (aantalMachines > Starters_c_aabtalMachines_max)
{
returnValue = false;
}
if (jaarproductieMachine1 > Starters_c_standaard_jaarProductie_max)
{
returnValue = false;
}
if (jaarproductieMachine2 > Starters_c_standaard_jaarProductie_max)
{
returnValue = false;
}
if (jaarproductieMachine3 > Starters_c_standaard_jaarProductie_max)
{
returnValue = false;
}
if (verkoopprijs < Starters_c_standaard_verkoopPrijs_min || verkoopprijs > Starters_c_standaard_verkoopPrijs_max)
{
returnValue = false;
}
if (winstmargeWinkel < Starters_c_standaard_winstMarge_min || winstmargeWinkel > Starters_c_standaard_winstMarge_max)
{
returnValue = false;
}
if (kwaliteit < Starters_c_standaard_kwaliteit_min || kwaliteit > Starters_c_standaard_kwaliteit_max)
{
returnValue = false;
}
if (reclame < Starters_c_standaard_reclame_min || reclame > Starters_c_standaard_reclame_max)
{
returnValue = false;
}
return returnValue;
}
if (standaard == MachineStandaard::Luxe)
{
if (aantalMachines > Starters_c_aabtalMachines_max)
{
returnValue = false;
}
if (jaarproductieMachine1 > Starters_c_luxe_jaarProductie_max)
{
returnValue = false;
}
if (jaarproductieMachine2 > Starters_c_luxe_jaarProductie_max)
{
returnValue = false;
}
if (jaarproductieMachine3 > Starters_c_luxe_jaarProductie_max)
{
returnValue = false;
}
if (verkoopprijs < Starters_c_luxe_verkoopPrijs_min || verkoopprijs > Starters_c_luxe_verkoopPrijs_max)
{
returnValue = false;
}
if (winstmargeWinkel < Starters_c_luxe_winstMarge_min || winstmargeWinkel > Starters_c_luxe_winstMarge_max)
{
returnValue = false;
}
if (kwaliteit < Starters_c_luxe_kwaliteit_min || kwaliteit > Starters_c_luxe_kwaliteit_max)
{
returnValue = false;
}
if (reclame < Starters_c_luxe_reclame_min || reclame > Starters_c_luxe_reclame_max)
{
returnValue = false;
}
return returnValue;
}
debugErrorln("Starters_c::checkInput() - Invalid input");
return 0;
}
float Starters_c::calculate()
{
// A productie
// Machine 1
this->A3 = ProductieKosten(this->standaard, this->A2);
this->A4 = this->A2 * this->A3;
// Machine 2
this->A6 = ProductieKosten(this->standaard, this->A5);
this->A7 = this->A5 * this->A6;
// Machine 3
this->A9 = ProductieKosten(this->standaard, this->A8);
this->A10 = this->A8 * this->A9;
// Totale productiekosten
this->A11 = this->A4 + this->A7 + this->A10;
this->A12 = this->A2 + this->A5 + this->A8;
this->A13 = static_cast<float>(this->A11) / static_cast<float>(this->A12);
// B marketing
// ingevuld door constructor
// C Bestellingen
this->C1 = 2000;
this->C2 = ExtraBestellingenVerkoopPrijs(this->standaard, this->B1);
this->C3 = ExtraBestellingenWinstmarge(this->standaard, this->B2);
this->C4 = ExtraBestellingenKwaliteit(this->standaard, this->B3);
this->C5 = ExtraBestellingenReclame(this->standaard, this->B4);
this->C6 = this->C1 + this->C2 + this->C3 + this->C4 + this->C5;
if (this->C6 < this->A12)
this->C7 = this->C6;
else
this->C7 = this->A12;
// D Resultaatberekeningen
this->D1 = this->C7;
this->D2 = this->B1;
this->D3 = this->D1 * this->D2;
this->D4 = this->D1 * this->A13;
this->D5 = this->D3 * this->B2 / 100;
this->D6 = this->D3 - this->D4 - this->D5;
this->D7 = this->B3;
this->D8 = this->B4;
if (standaard == MachineStandaard::Standaard)
this->D9 = this->A12 - this->C7;
else
this->D9 = 2 * (this->A12 - this->C7);
this->D10 = this->D6 - this->D7 - this->D8 - this->D9;
return this->D10;
debugErrorln("Starters_c::calculate() - Invalid input");
return -1;
}
float Starters_c::ProductiKostenLuxe(unsigned int productieAantal)
{
if (productieAantal == 0)
return 0;
if (productieAantal <= 600)
return 31.50;
if (productieAantal <= 650)
return 31.30;
if (productieAantal <= 700)
return 30.80;
if (productieAantal <= 750)
return 29.80;
if (productieAantal <= 800)
return 28.10;
if (productieAantal <= 850)
return 26.50;
if (productieAantal <= 900)
return 25.20;
if (productieAantal <= 950)
return 24.40;
if (productieAantal <= 1000)
return 24.00;
if (productieAantal <= 1050)
return 24.40;
if (productieAantal <= 1100)
return 25.20;
if (productieAantal <= 1150)
return 26.50;
if (productieAantal <= 1200)
return 28.10;
if (productieAantal <= 1250)
return 29.80;
if (productieAantal <= 1300)
return 30.80;
if (productieAantal <= 1350)
return 31.30;
if (productieAantal >= 1400 && productieAantal <= 2000)
return 31.50;
debugErrorln("ProductiKostenStandaard: productieAantal " + std::to_string(productieAantal) + " niet in range");
return -1;
}
float Starters_c::ProductiKostenStandaard(unsigned int productieAantal)
{
if (productieAantal == 0)
return 0;
if (productieAantal <= 1200)
return 27.50;
if (productieAantal <= 1300)
return 27.30;
if (productieAantal <= 1400)
return 26.80;
if (productieAantal <= 1500)
return 25.80;
if (productieAantal <= 1600)
return 24.10;
if (productieAantal <= 1700)
return 22.50;
if (productieAantal <= 1800)
return 21.20;
if (productieAantal <= 1900)
return 20.40;
if (productieAantal <= 2000)
return 20.00;
if (productieAantal <= 2100)
return 20.40;
if (productieAantal <= 2200)
return 21.20;
if (productieAantal <= 2300)
return 22.50;
if (productieAantal <= 2400)
return 24.10;
if (productieAantal <= 2500)
return 25.80;
if (productieAantal <= 2600)
return 26.80;
if (productieAantal <= 2700)
return 27.30;
if (productieAantal >= 28000 && productieAantal <= 4000)
return 27.50;
debugErrorln("ProductiKostenLuxe: productieAantal " + std::to_string(productieAantal) + " is niet in range");
return -1;
}
float Starters_c::ProductieKosten(Starters_c::MachineStandaard standaard, unsigned int productieAantal)
{
switch (standaard)
{
case MachineStandaard::Standaard:
return ProductiKostenStandaard(productieAantal);
break;
case MachineStandaard::Luxe:
return ProductiKostenLuxe(productieAantal);
break;
default:
return -1;
break;
}
}
int Starters_c::ExtraBestellingenVerkoopPrijsStandaard(unsigned int verkoopprijs)
{
if (verkoopprijs == 34)
return 600;
if (verkoopprijs == 35)
return 540;
if (verkoopprijs == 36)
return 480;
if (verkoopprijs == 37)
return 420;
if (verkoopprijs == 38)
return 360;
if (verkoopprijs == 39)
return 300;
if (verkoopprijs == 40)
return 240;
if (verkoopprijs == 41)
return 180;
if (verkoopprijs == 42)
return 120;
if (verkoopprijs == 43)
return 60;
if (verkoopprijs == 44)
return 0;
debugErrorln("ExtraBestellingenVerkoopPrijsStandaard: verkoopprijs " + std::to_string(verkoopprijs) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenVerkoopPrijsLuxe(unsigned int verkoopprijs)
{
if (verkoopprijs == 95)
return 10;
if (verkoopprijs == 96)
return 9;
if (verkoopprijs == 97)
return 8;
if (verkoopprijs == 98)
return 7;
if (verkoopprijs == 99)
return 6;
if (verkoopprijs == 100)
return 5;
if (verkoopprijs == 101)
return 4;
if (verkoopprijs == 102)
return 3;
if (verkoopprijs == 103)
return 2;
if (verkoopprijs == 104)
return 1;
if (verkoopprijs == 105)
return 0;
debugErrorln("ExtraBestellingenVerkoopPrijsLuxe: verkoopprijs " + std::to_string(verkoopprijs) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenVerkoopPrijs(Starters_c::MachineStandaard standaard, unsigned int verkoopprijs)
{
switch (standaard)
{
case MachineStandaard::Standaard:
return ExtraBestellingenVerkoopPrijsStandaard(verkoopprijs);
break;
case MachineStandaard::Luxe:
return ExtraBestellingenVerkoopPrijsLuxe(verkoopprijs);
break;
default:
return -1;
break;
}
}
int Starters_c::ExtraBestellingenWinstmargeStandaard(unsigned int winstmarge)
{
if (winstmarge == 15)
return 30;
if (winstmarge == 20)
return 40;
if (winstmarge == 25)
return 50;
if (winstmarge == 30)
return 60;
if (winstmarge == 35)
return 70;
if (winstmarge == 40)
return 80;
if (winstmarge == 45)
return 90;
if (winstmarge == 50)
return 100;
if (winstmarge >= 15 && winstmarge <= 50)
return winstmarge * 100 / 50;
debugErrorln("ExtraBestellingenWinstmargeLuxe: winstmarge " + std::to_string(winstmarge) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenWinstmargeLuxe(unsigned int winstmarge)
{
if (winstmarge == 25)
return 375;
if (winstmarge == 30)
return 450;
if (winstmarge == 35)
return 525;
if (winstmarge == 40)
return 600;
if (winstmarge == 45)
return 675;
if (winstmarge == 50)
return 750;
if (winstmarge >= 25 && winstmarge <= 50)
return winstmarge * 750 / 50;
debugErrorln("ExtraBestellingenWinstmargeLuxe: winstmarge " + std::to_string(winstmarge) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenWinstmarge(MachineStandaard standaard, unsigned int winstmarge)
{
switch (standaard)
{
case MachineStandaard::Standaard:
return ExtraBestellingenWinstmargeStandaard(winstmarge);
break;
case MachineStandaard::Luxe:
return ExtraBestellingenWinstmargeLuxe(winstmarge);
break;
default:
return -1;
break;
}
}
int Starters_c::ExtraBestellingenKwaliteitStandaard(unsigned int budgetKwaliteit)
{
if (budgetKwaliteit == 3000)
return 75;
if (budgetKwaliteit == 4000)
return 100;
if (budgetKwaliteit == 5000)
return 125;
if (budgetKwaliteit == 6000)
return 150;
if (budgetKwaliteit == 7000)
return 175;
if (budgetKwaliteit == 8000)
return 200;
if (budgetKwaliteit == 9000)
return 225;
if (budgetKwaliteit == 10000)
return 250;
if (budgetKwaliteit >= 3000 && budgetKwaliteit <= 10000)
return budgetKwaliteit * 250 / 10000;
debugErrorln("ExtraBestellingenKwaliteitStandaard: budgetKwaliteit " + std::to_string(budgetKwaliteit) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenKwaliteitLuxe(unsigned int budgetKwaliteit)
{
if (budgetKwaliteit == 50000)
return 500;
if (budgetKwaliteit == 60000)
return 600;
if (budgetKwaliteit == 70000)
return 700;
if (budgetKwaliteit == 80000)
return 800;
if (budgetKwaliteit == 90000)
return 900;
if (budgetKwaliteit == 100000)
return 1000;
if (budgetKwaliteit >= 5000 && budgetKwaliteit <= 100000)
return budgetKwaliteit * 1000 / 100000;
debugErrorln("ExtraBestellingenKwaliteitLuxe: budgetKwaliteit " + std::to_string(budgetKwaliteit) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenKwaliteit(MachineStandaard standaard, unsigned int budgetKwaliteit)
{
switch (standaard)
{
case MachineStandaard::Standaard:
return ExtraBestellingenKwaliteitStandaard(budgetKwaliteit);
break;
case MachineStandaard::Luxe:
return ExtraBestellingenKwaliteitLuxe(budgetKwaliteit);
break;
default:
return -1;
break;
}
}
int Starters_c::ExtraBestellingenReclameStandaard(unsigned int budgetReclame)
{
if (budgetReclame == 25000)
return 1500;
if (budgetReclame == 30000)
return 1800;
if (budgetReclame == 35000)
return 2100;
if (budgetReclame == 40000)
return 2400;
if (budgetReclame == 45000)
return 2700;
if (budgetReclame == 50000)
return 3000;
if (budgetReclame >= 25000 && budgetReclame <= 50000)
return budgetReclame * 3000 / 50000;
debugErrorln("ExtraBestellingenReclameStandaard: budgetReclame " + std::to_string(budgetReclame) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenReclameLuxe(unsigned int budgetReclame)
{
if (budgetReclame == 25000)
return 375;
if (budgetReclame == 30000)
return 450;
if (budgetReclame == 35000)
return 525;
if (budgetReclame == 40000)
return 600;
if (budgetReclame == 45000)
return 675;
if (budgetReclame == 50000)
return 750;
if (budgetReclame >= 25000 && budgetReclame <= 50000)
return budgetReclame * 750 / 50000;
debugErrorln("ExtraBestellingenReclameLuxe: budgetReclame " + std::to_string(budgetReclame) + " is niet in range");
return -1;
}
int Starters_c::ExtraBestellingenReclame(MachineStandaard standaard, unsigned int budgetReclame)
{
switch (standaard)
{
case MachineStandaard::Standaard:
return ExtraBestellingenReclameStandaard(budgetReclame);
break;
case MachineStandaard::Luxe:
return ExtraBestellingenReclameLuxe(budgetReclame);
break;
default:
return -1;
break;
}
}

View File

@@ -0,0 +1,115 @@
#include <string>
#include <algorithm>
#include <functional>
#include <ctime>
#include "debug.hpp"
#define Starters_c_aabtalMachines_max 3
#define Starters_c_standaard_jaarProductie_max 4000
#define Starters_c_standaard_verkoopPrijs_min 34
#define Starters_c_standaard_verkoopPrijs_max 44
#define Starters_c_standaard_winstMarge_min 15
#define Starters_c_standaard_winstMarge_max 50
#define Starters_c_standaard_kwaliteit_min 3000
#define Starters_c_standaard_kwaliteit_max 10000
#define Starters_c_standaard_reclame_min 25000
#define Starters_c_standaard_reclame_max 50000
#define Starters_c_luxe_jaarProductie_max 2000
#define Starters_c_luxe_verkoopPrijs_min 95
#define Starters_c_luxe_verkoopPrijs_max 105
#define Starters_c_luxe_winstMarge_min 25
#define Starters_c_luxe_winstMarge_max 50
#define Starters_c_luxe_kwaliteit_min 5000
#define Starters_c_luxe_kwaliteit_max 10000
#define Starters_c_luxe_reclame_min 25000
#define Starters_c_luxe_reclame_max 50000
class Starters_c
{
public:
enum class MachineStandaard {Standaard, Luxe};
Starters_c(MachineStandaard standaard, unsigned int jaarproductieMachine1,
unsigned int jaarproductieMachine2,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame);
Starters_c(MachineStandaard standaard, unsigned int jaarproductieMachine1,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame);
Starters_c(MachineStandaard standaard, unsigned int aantalMachines, unsigned int jaarproductieMachine1,
unsigned int jaarproductieMachine2, unsigned int jaarproductieMachine3,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame);
bool checkInput(MachineStandaard standaard, unsigned int aantalMachines, unsigned int jaarproductieMachine1,
unsigned int jaarproductieMachine2, unsigned int jaarproductieMachine3,
unsigned int verkoopprijs, unsigned int winstmargeWinkel, unsigned int kwaliteit, unsigned int reclame);
float calculate();
private:
protected:
float ProductiKostenStandaard(unsigned int productieAantal);
float ProductiKostenLuxe(unsigned int productieAantal);
float ProductieKosten(MachineStandaard standaard, unsigned int productieAantal);
int ExtraBestellingenVerkoopPrijsStandaard(unsigned int verkoopprijs);
int ExtraBestellingenVerkoopPrijsLuxe(unsigned int verkoopprijs);
int ExtraBestellingenVerkoopPrijs(MachineStandaard standaard, unsigned int verkoopprijs);
int ExtraBestellingenWinstmargeStandaard(unsigned int winstmarge);
int ExtraBestellingenWinstmargeLuxe(unsigned int winstmarge);
int ExtraBestellingenWinstmarge(MachineStandaard standaard, unsigned int winstmarge);
int ExtraBestellingenKwaliteitStandaard(unsigned int budgetKwaliteit);
int ExtraBestellingenKwaliteitLuxe(unsigned int budgetKwaliteit);
int ExtraBestellingenKwaliteit(MachineStandaard standaard, unsigned int budgetKwaliteit);
int ExtraBestellingenReclameStandaard(unsigned int budgetReclame);
int ExtraBestellingenReclameLuxe(unsigned int budgetReclame);
int ExtraBestellingenReclame(MachineStandaard standaard, unsigned int budgetReclame);
void calculateProductie(void);
void calculateMarketing(void);
void calculateBestellingen(void);
void calculateResulaat(void);
MachineStandaard standaard;
int A1 = 0;
int A2 = 0;
int A3 = 0;
int A4 = 0;
int A5 = 0;
int A6 = 0;
int A7 = 0;
int A8 = 0;
int A9 = 0;
int A10 = 0;
int A11 = 0;
int A12 = 0;
float A13 = 0;
int B1 = 0;
int B2 = 0;
int B3 = 0;
int B4 = 0;
int C1 = 200;
int C2 = 0;
int C3 = 0;
int C4 = 0;
int C5 = 0;
int C6 = 0;
int C7 = 0;
int D1 = 0;
int D2 = 0;
int D3 = 0;
int D4 = 0;
int D5 = 0;
int D6 = 0;
int D7 = 0;
int D8 = 0;
int D9 = 0;
int D10 = 0;
};

View File

@@ -0,0 +1 @@
#include "Starters.hpp"