aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 66ce4189a1569afb34a820519754448d0b5213dd (plain) (blame)
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
use hiccup::Mortgage;
use hiccup::MortgageUpdate::*;
use hiccup::MortgageUpdates;
use std::collections::HashMap;

fn h1() {
    let m = Mortgage::new(390_000., 0.028, 30);

    let updates: MortgageUpdates = HashMap::from_iter((0..29).map(|y| match y {
        0 => (0, Amortize(30_000.)),
        _ => (y * 12, Amortize(12_000.)),
    }));
    let sim = m.clone().simulate(updates);
    sim.render_table();
}

fn h2() {
    let m = Mortgage::new(200_000., 0.01621, 30);
    let sim = m.clone().simulate(HashMap::new());
    sim.render_table();
}

fn main() {
    h1();
}