
/*******************************************
****            C++ example             ****
**** (c) 2017-2019, Alessandro Pedretti ****
*******************************************/


#include <stdio.h>
#include "financial_service_cpp.h"


/**** Main code ****/

int main(int Argc, char *Argv[])
{
  T2CPP_FINANCIAL_SERVICE     Model;


  /**** Prediction example 1 ****/

  Model.LifeStyle = T2CPP_FINANCIAL_SERVICE_LIFESTYLE_SPENDGSAVING;
  Model.Type      = T2CPP_FINANCIAL_SERVICE_TYPE_STUDENT;
  Model.Vacation  = 6.0f;
  Model.eCredit   = 40.0f;
  Model.property  = 3.2804f;
  Model.salary    = 13.62f;

  printf("\n* Example #1\n");
  printf("  Domain violations: %d (must be 0)\n", Model.DomCheck());
  printf("  Predicted class:   %d (real 0)\n", Model.Classify());


  /**** Prediction example 2 ****/

  Model.LifeStyle = T2CPP_FINANCIAL_SERVICE_LIFESTYLE_SPENDGSAVING;
  Model.Type      = T2CPP_FINANCIAL_SERVICE_TYPE_LIBRARIAN;
  Model.Vacation  = 7.0f;
  Model.eCredit   = 10.0f;
  Model.property  = 1.2225f;
  Model.salary    = 18.1751f;

  printf("\n* Example #2\n");
  printf("  Domain violations: %d (must be 0)\n", Model.DomCheck());
  printf("  Predicted class:   %d (real 1)\n", Model.Classify());

  /**** Prediction example 3 ****/

  Model.LifeStyle = T2CPP_FINANCIAL_SERVICE_LIFESTYLE_SPENDLSAVING;
  Model.Type      = T2CPP_FINANCIAL_SERVICE_TYPE_STUDENT;
  Model.Vacation  = 6.0f;
  Model.eCredit   = 73.0f;
  Model.property  = 4.8256f;
  Model.salary    = 31.75f;

  printf("\n* Example #3\n");
  printf("  Domain violations: %d (must be 0)\n", Model.DomCheck());
  printf("  Predicted class:   %d (real 2)\n", Model.Classify());

  /**** Prediction example 4 ****/

  Model.LifeStyle = T2CPP_FINANCIAL_SERVICE_LIFESTYLE_SPENDLSAVING;
  Model.Type      = T2CPP_FINANCIAL_SERVICE_TYPE_DOCTOR;
  Model.Vacation  = 47.0f;
  Model.eCredit   = 51.0f;
  Model.property  = 5.6494f;
  Model.salary    = 18.45f;

  printf("\n* Example #4\n");
  printf("  Domain violations: %d (must be 0)\n", Model.DomCheck());
  printf("  Predicted class:   %d (real 3)\n", Model.Classify());

  /**** Prediction example 5 ****/

  Model.LifeStyle = T2CPP_FINANCIAL_SERVICE_LIFESTYLE_SPENDGSAVING;
  Model.Type      = T2CPP_FINANCIAL_SERVICE_TYPE_PROFESSOR;
  Model.Vacation  = 48.0f;
  Model.eCredit   = 5.0f;
  Model.property  = 1.7536f;
  Model.salary    = 20.39f;

  printf("\n* Example #5\n");
  printf("  Domain violations: %d (must be 0)\n", Model.DomCheck());
  printf("  Predicted class:   %d (real 4)\n", Model.Classify());

  return 0;
}
