From 16d59ed88dd13e36c0fe83dd5b6a3354bef2e875 Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Sat, 25 Feb 2023 19:22:53 +0000 Subject: [PATCH] Converted to double --- 1ano/2semestre/poo/src/aula03/Investment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1ano/2semestre/poo/src/aula03/Investment.java b/1ano/2semestre/poo/src/aula03/Investment.java index fac08a3..3730a5a 100644 --- a/1ano/2semestre/poo/src/aula03/Investment.java +++ b/1ano/2semestre/poo/src/aula03/Investment.java @@ -9,7 +9,7 @@ public class Investment { public static void main(String[] args) { Scanner sin = new Scanner(System.in); - int investment; + double investment; do { System.out.print("Introduza o investimento inicial (múltiplo de 1000): "); investment = sin.nextInt(); @@ -20,7 +20,7 @@ public class Investment { for (int i = 1; i <= 12; i++) { investment *= 1+tax/100; - System.out.printf("Investimento em %d %s: %d\n", i, i==1?"mês":"meses", investment); + System.out.printf("Investimento em %d %s: %.2f\n", i, i==1?"mês":"meses", investment); } sin.close();