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


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



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

int main(int Argc, char *Argv[])
{
  T2C_FINANCIAL_SERVICE_INPUT   Input;


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

  Input.LifeStyle = T2C_FINANCIAL_SERVICE_LIFESTYLE_SPENDGSAVING;
  Input.Type      = T2C_FINANCIAL_SERVICE_TYPE_STUDENT;
  Input.Vacation  = 6.0f;
  Input.eCredit   = 40.0f;
  Input.property  = 3.2804f;
  Input.salary    = 13.62f;

  printf("\n* Example #1\n");
  printf("  Domain violations: %d (must be 0)\n", T2C_FINANCIAL_SERVICE_DomCheck(&Input));
  printf("  Predicted class:   %d (real 0)\n", T2C_FINANCIAL_SERVICE_Classify(&Input));


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

  Input.LifeStyle = T2C_FINANCIAL_SERVICE_LIFESTYLE_SPENDGSAVING;
  Input.Type      = T2C_FINANCIAL_SERVICE_TYPE_LIBRARIAN;
  Input.Vacation  = 7.0f;
  Input.eCredit   = 10.0f;
  Input.property  = 1.2225f;
  Input.salary    = 18.1751f;

  printf("\n* Example #2\n");
  printf("  Domain violations: %d (must be 0)\n", T2C_FINANCIAL_SERVICE_DomCheck(&Input));
  printf("  Predicted class:   %d (real 1)\n", T2C_FINANCIAL_SERVICE_Classify(&Input));

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

  Input.LifeStyle = T2C_FINANCIAL_SERVICE_LIFESTYLE_SPENDLSAVING;
  Input.Type      = T2C_FINANCIAL_SERVICE_TYPE_STUDENT;
  Input.Vacation  = 6.0f;
  Input.eCredit   = 73.0f;
  Input.property  = 4.8256f;
  Input.salary    = 31.75f;

  printf("\n* Example #3\n");
  printf("  Domain violations: %d (must be 0)\n", T2C_FINANCIAL_SERVICE_DomCheck(&Input));
  printf("  Predicted class:   %d (real 2)\n", T2C_FINANCIAL_SERVICE_Classify(&Input));

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

  Input.LifeStyle = T2C_FINANCIAL_SERVICE_LIFESTYLE_SPENDLSAVING;
  Input.Type      = T2C_FINANCIAL_SERVICE_TYPE_DOCTOR;
  Input.Vacation  = 47.0f;
  Input.eCredit   = 51.0f;
  Input.property  = 5.6494f;
  Input.salary    = 18.45f;

  printf("\n* Example #4\n");
  printf("  Domain violations: %d (must be 0)\n", T2C_FINANCIAL_SERVICE_DomCheck(&Input));
  printf("  Predicted class:   %d (real 3)\n", T2C_FINANCIAL_SERVICE_Classify(&Input));

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

  Input.LifeStyle = T2C_FINANCIAL_SERVICE_LIFESTYLE_SPENDGSAVING;
  Input.Type      = T2C_FINANCIAL_SERVICE_TYPE_PROFESSOR;
  Input.Vacation  = 48.0f;
  Input.eCredit   = 5.0f;
  Input.property  = 1.7536f;
  Input.salary    = 20.39f;

  printf("\n* Example #5\n");
  printf("  Domain violations: %d (must be 0)\n", T2C_FINANCIAL_SERVICE_DomCheck(&Input));
  printf("  Predicted class:   %d (real 4)\n", T2C_FINANCIAL_SERVICE_Classify(&Input));

  return 0;
}
