Write a program that calculates and displays the income tax of a salary entered from the keyboard. Your program must calculate taxes according to the following rates:
Up to 200Br 0%
200Br .600Br 10%
600Br 1200Br 15%
1200Br 2000Br 20%
2000Br-3500Br 25%
3500Br & above 30%
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double salary;
double tax;
cout << "Enter salary value: ";
cin >> salary;
if (salary <= 200) {
tax = 0;
}
else if (salary <= 600) {
tax = 0.1 * salary;
}
else if (salary <= 1200) {
tax = 0.15 * salary;
}
else if (salary <= 2000) {
tax = 0.2 * salary;
}
else if (salary <= 3500) {
tax = 0.25 * salary;
}
else {
tax = 0.3 * salary;
}
cout << "The tax is " << fixed << setprecision(2)
<< tax << "Br" << endl;
return 0;
}
Comments
Leave a comment