Answer to Question #308759 in C++ for Bile

Question #308759

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%

1
Expert's answer
2022-03-10T02:09:24-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog