From 0751b55f611b889f63dfc2bc2705e7537703cb43 Mon Sep 17 00:00:00 2001 From: gonzo Date: Fri, 19 May 2023 22:17:58 +0200 Subject: added loan struct to abstract over loan types --- loans.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'loans.h') diff --git a/loans.h b/loans.h index fd276ae..88bbb41 100644 --- a/loans.h +++ b/loans.h @@ -3,6 +3,20 @@ #include #include "contract.h" +typedef enum loan_type { + BULLET, + STRAIGHTLINE, + MORTGAGE, +} 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, float r, float P); float bullet_update(contract *); @@ -17,3 +31,8 @@ void sl_free(contract *); contract *mort_init(int n, int d, float r, float P); float mort_update(contract *); void mort_free(contract *); + +/**** GENERAL LOAN STUFF ****/ +loan loan_init(loan_type type, int n, int d, float r, float P); +float loan_update(loan); +void loan_free(loan); -- cgit v1.2.3