Write a program that reads an employee name, salary and allowances. The program should then:
• Call a function to calculate the employee income tax;
• Calculate net pay;
• Clear screen and print employee name, salary, income tax, and net pay under the following header.
Employee Name Salary Tax Net Pay
Note:
• Income tax is not levied on personnel allowances and is levied at 25%.
• A personnel allowance, which varies from person to person, is between £3500 and £4500.
Program skeleton
#include<iostream>
#include<iomanip>
usingnamespace std;
//function that calculates income tax
void getIncomeTax(. . . . . . . .. )
{
. . . . . . . . . .
}
void main()
{ double salary, allowances, incomeTax;
char name[30]; //a array of characters.
//Read 'Name' in this array using ‘getline’ function.
//clear screen
. . . . . .
//read data (employee name, salary and allowances)
. . . . . . .
//call functions that calculates Income Tax
// incomeTax should passed by reference.
. . . . . . .
//calculate net pay
. . . . . . . .
//display under a header employee name, salary, tax
//and net pay.
. . . . . . . . .
}
i tried hours but couldnt write allways getting lots of error.
anybody have free time to help me???
thanks.
1. anything you have that isn't code should be commented otherwise you will get errors.
2. main should be like this int main()
3. i would think getIncomeTax function should be type double not void with a float returned and you need parameters in your function
4. you will need to add the code for the function ater the main section
5. the call to your function should look like this incomeTax=getIncomeTax(salary); at the minimum
That should be a start for you. right now from the code you posted fix all the stuff that is not actuall code by commenting it out and add code to do what you want. You might want to write the steps you have to do on paper first. for ex.
1. get salary
2. get net pay
ect....