URI Problem (Taxes) 1051:
Taxes is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 14, 2016
* @Time : 6:03:24 PM
*/
public class Uri1051 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double salary, tax = 0;
salary = sc.nextDouble();
if (salary >= 0.0 && salary <= 2000.00) {
System.out.println("Isento");
} else if (salary >= 2000.01 && salary <= 3000.00) {
tax += (salary - 2000.00) * 0.08;
System.out.printf("R$ %.2f\n", tax);
} else if (salary >= 3000.01 && salary <= 4500.00) {
tax += 1000.00 * 0.08;
tax += (salary - 3000) * 0.18;
System.out.printf("R$ %.2f\n", tax);
} else if (salary > 4500.00) {
tax += 1000.00 * 0.08;
tax += 1500.00 * 0.18;
tax += (salary - 4500.00) * 0.28;
System.out.printf("R$ %.2f\n", tax);
}
}
}
0 Comments