diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -50,18 +50,8 @@ impl Simulation { ); println!("========================================================"); - println!("\n\n# A PRIORI\n"); - println!( - "== Total a pagar: {:.2} ({} cap + {:.2} int)", - self.topay_total, mortgage.principal, self.topay_interest - ); - println!( - "== Los intereses suponen un {:.2}% del total", - 100. * self.topay_interest / self.topay_total - ); - println!("\n\n# SIMULACIÓN CUOTAS\n"); - println!("Year | Month | Quota\t(Intrst + Amrtzd)\tPrincipal"); + println!("Year | Mon | Quota ( Intrst + Amrtzd) | Principal"); for mortgage in self.history.iter() { print!("{mortgage}"); if let Some(update) = self.updates.get(&mortgage.period) { @@ -72,6 +62,16 @@ impl Simulation { let payed_total = self.payed_principal + self.payed_interest + self.payed_amortized; + println!("\n\n# A PRIORI\n"); + println!( + "== Total a pagar: {:.2} ({} cap + {:.2} int)", + self.topay_total, mortgage.principal, self.topay_interest + ); + println!( + "== Los intereses suponen un {:.2}% del total", + 100. * self.topay_interest / self.topay_total + ); + println!("\n\n# RESULTADO FINAL\n"); println!( "== Total pagado: {:.2} ({:.2} cap + {:.2} int + {:.2} amortizado)", @@ -98,7 +98,7 @@ impl fmt::Display for Mortgage { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, - "{:4} | {:5} | {:4.2}\t({:.2} + {:.2})\t{:.2}", + "{:4} | {:3} | {:7.2} ({:7.2} + {:7.2}) | {:10.2}", if self.period % 12 == 0 { format!("Y{}", (self.period / 12) + 1) } else { |