1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#pragma once
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "contract.h"
typedef enum loan_type {
BULLET = 0,
STRAIGHTLINE = 1,
MORTGAGE = 2,
} loan_type;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
typedef struct loan {
loan_type type;
contract *c;
} loan;
#pragma clang diagnostic pop
/**** BULLET LOAN ****/
contract *bullet_init(int n, int d, double r, double P);
double bullet_update(contract *);
void bullet_free(contract *c);
/**** STRAIGHT LINE ****/
contract *sl_init(int n, int d, double r, double P);
double sl_update(contract *);
void sl_free(contract *);
/**** MORTGAGE ****/
contract *mort_init(int n, int d, double r, double P);
double mort_update(contract *);
void mort_free(contract *);
/**** GENERAL LOAN STUFF ****/
loan loan_init(loan_type type, int n, int d, double r, double P);
double loan_update(loan);
void loan_free(loan);
/**** read loan type ****/
loan_type read_loan_type(char **contract_subtypes, char *lt);
|