Refactored to utils method

This commit is contained in:
TiagoRG 2023-02-26 16:49:59 +00:00
parent eb84595809
commit 5c5752c890
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

@ -12,8 +12,8 @@ public class Investment {
double investment; double investment;
do { do {
System.out.print("Introduza o investimento inicial (múltiplo de 1000): "); System.out.print("Introduza o investimento inicial (múltiplo de 1000): ");
investment = sin.nextInt(); investment = UserInput.getPositiveNumber(sin);
} while (investment <= 0 || investment % 1000 != 0); } while (investment % 1000 != 0);
System.out.print("Introduza a taxa a aplicar (entre 0% e 5%): "); System.out.print("Introduza a taxa a aplicar (entre 0% e 5%): ");
double tax = UserInput.getNumberBetween(sin, 0, 5); double tax = UserInput.getNumberBetween(sin, 0, 5);