forked from elasComputacao/BabySteps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1051.java
40 lines (30 loc) · 881 Bytes
/
1051.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double imposto = 0.00;
double salario = input.nextDouble();
if(2000.00 < salario && salario <= 3000.00) {
imposto += calculaImposto(salario - 2000.00, 8);
}
else if(3000.00 < salario && salario <= 4500.00) {
imposto += calculaImposto(1000.00, 8);
imposto += calculaImposto(salario - 3000.00, 18);
}
else if(4500.00 < salario) {
imposto += calculaImposto(1000.00, 8);
imposto += calculaImposto(1500.00, 18);
imposto += calculaImposto(salario - 4500.00, 28);
}
if(imposto == 0.00) {
System.out.println("Isento");
}
else {
System.out.printf("R$ %.2f%n", imposto);
}
input.close();
}
public static double calculaImposto(double valor, int taxa) {
return valor * taxa / 100;
}
}