From 5c5752c890ec79e8445600dfe08d2e4929b8c292 Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Sun, 26 Feb 2023 16:49:59 +0000 Subject: [PATCH] Refactored to utils method --- 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 3730a5a..92cb2cd 100644 --- a/1ano/2semestre/poo/src/aula03/Investment.java +++ b/1ano/2semestre/poo/src/aula03/Investment.java @@ -12,8 +12,8 @@ public class Investment { double investment; do { System.out.print("Introduza o investimento inicial (mĂșltiplo de 1000): "); - investment = sin.nextInt(); - } while (investment <= 0 || investment % 1000 != 0); + investment = UserInput.getPositiveNumber(sin); + } while (investment % 1000 != 0); System.out.print("Introduza a taxa a aplicar (entre 0% e 5%): "); double tax = UserInput.getNumberBetween(sin, 0, 5);