Answer to Question #287856 in C++ for bazwalasim

Question #287856

You are an accountant setting up a payroll system based on Table, which shows five different ranges for salaries up to Rs.150, 000.00. Each table line shows the base tax amount (column2) and tax percentage (column3) for a particular salary range (column1).


Write a function that taken person’s salary and calculate the tax due by adding the base tax to the product of the percentage times the excess salary over the minimum salary for that range

1
Expert's answer
2022-01-16T04:16:31-0500
#include <iostream>
using namespace std;
double calcTax(double salary){
    double base_tax, minimum, percentage;
    cout<<"Input base tax: ";
    cin>>base_tax;
    cout<<"Enter tax percentage for this range: ";
    cin>>percentage;
    cout<<"Input the minimum salary for this range: ";
    cin>>minimum;


    return base_tax + percentage / 100 * (salary - minimum);
}
int main(){
    double salary;
    cout<<"Input salary: ";
    cin>>salary;


    cout<<"Total tax: "<<calcTax(salary)<<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