Answer to Question #279159 in C++ for Cracy

Question #279159

Write a c program in which the user enters his/her salary and the program computes the relevant tax according to the table below



SALARY RANGE. TAX(%)



<=170000. 0%



170000 - 360000. 11%



360,000 - 540000. 20%



540000 - 720000. 25%



>720000. 30%

1
Expert's answer
2021-12-13T13:45:48-0500
#include <iostream>


int main()
{
    int salary;
    std::cout << "Enter your salary: \n";


    std::cin >> salary;
    int tax;
    if (salary <= 170000)
    {
        tax = 0;
    }
    else if (salary > 170000 && salary <= 360000)
    {
        tax = 11;
    }
    else if (salary > 360000 && salary <= 540000)
    {
        tax = 20;
    }
    else if (salary > 540000 && salary <= 720000)
    {
        tax = 25;
    }
    else tax = 30;
    double net_salary = static_cast<double>(salary) - static_cast<double>(salary) * static_cast<double>(tax) / 100;
    std::cout << "Your net salary is " << net_salary << "\n";


    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