summaryrefslogtreecommitdiffstats
path: root/loans.h
diff options
context:
space:
mode:
authorgonzo <gonzo@toniatuh.com>2023-05-19 22:17:58 +0200
committergonzo <gonzo@toniatuh.com>2023-05-19 22:17:58 +0200
commit0751b55f611b889f63dfc2bc2705e7537703cb43 (patch)
tree3a996ccde1904e92b910900d8d25c55424fff33d /loans.h
parentd01fc15a98e5ede02e3f9aff04e3d4014e6e484c (diff)
downloadloan_calc-0751b55f611b889f63dfc2bc2705e7537703cb43.tar.gz
added loan struct to abstract over loan types
Diffstat (limited to 'loans.h')
-rw-r--r--loans.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/loans.h b/loans.h
index fd276ae..88bbb41 100644
--- a/loans.h
+++ b/loans.h
@@ -3,6 +3,20 @@
#include <math.h>
#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);