14 filename = malloc(100*
sizeof(
char));
16 strcpy(filename,
"./outputs/data/Household_ID_Liquidity_Mortgages.txt");
17 file1 = fopen(filename,
"w");
38 if (MY_EMPLOYER_ID > 0) {
WAGE = 5.0;}
41 for (
int i = 0; i < 3; i++) {
53 filename = malloc(100*
sizeof(
char));
55 strcpy(filename,
"./outputs/data/Household_ID_Liquidity_Mortgages.txt");
56 file1 = fopen(filename,
"a");
74 double d1, d2, annuity;
76 double mortgage_cost_income_ratio = 0.2;
80 d2 = d1 * pow((1 + d1), 160);
81 annuity = 1/d1 - 1/d2;
82 MORTGAGES = total_income * mortgage_cost_income_ratio * annuity;
95 d2 = d1 * pow((1 + d1), 160);
96 annuity = 1/d1 - 1/d2;
97 MORTGAGES = total_income * mortgage_cost_income_ratio * annuity;
104 MORTGAGES = (total_income * mortgage_cost_income_ratio) / (0.02 / 4 + 1/160);
112 d2 = d1 * pow((1 + d1), 160);
113 annuity = 1/d1 - 1/d2;
114 MORTGAGES = total_income * mortgage_cost_income_ratio * annuity;
121 MORTGAGES = (total_income * mortgage_cost_income_ratio) / ((
MORTGAGES_LIST.array[0].interestrate + 0.01) / 4 + 1/160);
129 d2 = d1 * pow((1 + d1), 160);
130 annuity = 1/d1 - 1/d2;
131 MORTGAGES = total_income * mortgage_cost_income_ratio * annuity / (1 + (annuity * 0.02/4));
135 printf(
"Warning @household_housing_debt_writeoff(): Unexpected mortgage choice = %d \n",
MORTGAGE_CHOICE);
171 filename = malloc(100*
sizeof(
char));
178 strcpy(filename,
"./outputs/data/Household_Weekly.txt");
179 file1 = fopen(filename,
"w");
180 fprintf(file1,
"%s %s %s %s %s %s %s\n",
"IT_NO",
"ID",
"LIQUIDITY",
"WEEKLY_CONSUMPTION_BUDGET",
"money_to_spend",
"money_spent",
"quantity_bought");
186 strcpy(filename,
"./outputs/data/Household_Monthly_FirstDay.txt");
187 file1 = fopen(filename,
"w");
188 fprintf(file1,
"%s %s %s %s %s %s %s %s\n",
"IT_NO",
"ID",
"MORTGAGES",
"MORTGAGE_COST",
"HOUSING_UNITS",
"HOUSING_VALUE",
"EQUITY_RATIO",
"LIQUIDITY");
194 strcpy(filename,
"./outputs/data/Household_Monthly_LastDay.txt");
195 file1 = fopen(filename,
"w");
196 fprintf(file1,
"%s %s %s %s %s %s\n",
"IT_NO",
"ID",
"MY_EMPLOYER_ID",
"WAGE",
"unemployment_benefit",
"general_benefit");
202 strcpy(filename,
"./outputs/data/Household_Quarterly.txt");
203 file1 = fopen(filename,
"w");
204 fprintf(file1,
"%s %s %s %s %s %s %s %s %s %s %s\n",
"IT_NO",
"ID",
"TOTAL_ASSETS",
"LIQUIDITY",
"HOUSING_VALUE",
"LABOUR_INCOME",
"BENEFITS",
"CAPITAL_INCOME",
"MORTGAGES",
"HOUSING_PAYMENT",
"EQUITY");
227 if (
ID > 40 &&
ID < 60) {
228 printf(
"Household ID = %d has a liquidity amount = %f deposited to bank.\n",
ID,
LIQUIDITY);