Код: Выделить всё
salary >= 45,000 pays a 50% tax rate,
>= 30,000 pays a 30% and
everyone else pays 15%.
< /code>
Вот мой код: < /p>
public double salaryTax(double salary) {
double taxRate=0;
if (salary >= 45.000) {
taxRate = .5;
}
else if (salary >= 30.000) {
taxRate = .3;
}
else
{
taxRate = .15;
}
double tax = salary * taxRate;
double totalTax = tax + taxRate;
double netSalary = salary - totalTax;
return netSalary;
}
Подробнее здесь: https://stackoverflow.com/questions/585 ... ry-and-tax