Converted to double

This commit is contained in:
TiagoRG 2023-02-25 19:22:53 +00:00
parent 3cd0a089ac
commit 006a7e3a22
Signed by untrusted user who does not match committer: TiagoRG
GPG Key ID: DFCD48E3F420DB42
1 changed files with 2 additions and 2 deletions

View File

@ -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();