*/
package UVA_Pendientes;
import java.util.Scanner;
/**
*
* @author DAM116
*/
public class UVA12342_TaxCalculator {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int casos, num;
casos = entrada.nextInt();
for (int i = 0; i < casos; i++) {
num = entrada.nextInt();
System.out.println("Case " + (i + 1) + ": " + devolverImpuesto(num));
}
}
static int devolverImpuesto(int num) {
double diff, taxa = 0;
if (num > 180000) {
num -= 180000;
if (num > 0) {
diff = Math.min(num, 300000);
num -= diff;
taxa += 0.1 * diff;
}
if (num > 0) {
diff = Math.min(num, 400000);
num -= diff;
taxa += 0.15 * diff;
}
if (num > 0) {
diff = Math.min(num, 300000);
num -= diff;
taxa += 0.2 * diff;
}
if (num > 0) {
taxa += 0.25 * num;
}
taxa = Math.max(2000, taxa);
}
if (taxa != 0 && taxa != 2000) {
taxa = Math.round(taxa + 0.49);
}
return (int) taxa;
}
}
No hay comentarios:
Publicar un comentario