-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathTaxCalculation.java
More file actions
31 lines (25 loc) · 896 Bytes
/
TaxCalculation.java
File metadata and controls
31 lines (25 loc) · 896 Bytes
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
public class TaxCalculation {
public static void main(String[] args) {
//precios de los productos//
double productPrice1 = 100;
double productPrice2 = 200;
// tasas impositivas//
double taxRate1 = 0.15;
double taxRate2 = 0.10;
// Cálculo de impuestos
double tax1 = calculateTax(productPrice1, taxRate1);
double tax2 = calculateTax(productPrice2, taxRate2);
// Cálculo del impuesto total
double totalTax = tax1 + tax2;
// Evaluación del impuesto total
if (totalTax > 50) {
System.out.println("High total tax:: " + totalTax);
} else {
System.out.println("Low tax");
}
}
// Método para calcular el impuesto de un producto
private static double calculateTax(double price, double taxRate) {
return price * taxRate;
}
}