c program to compute Income tax and Net Salary for its employees. The company offers tax relief of Kshs. 650 for single employees and Kshs. 1,100 for married employees. The relief will be deducted from the Gross salary, to give the taxable income. This will be computed at the following rates: [10mks]
Taxable Income Rate (%)
<5000 0
5000-19999 6
20000-36999 9
37000 and above 16

Answer Posted / fa1thjp0

#include <stdio.h>

main ()
{
char employee_name, marital_status;
int employee_no;
float taxable_income, gross_income, tax, net_salary;

printf ("
Enter Employee Name:");
scanf ("%s", &employee_name);
printf ("
Enter Employee Number:");
scanf ("%d", &employee_no);
printf ("
Enter Employee marital status:");
scanf ("%s", &marital_status);
printf ("
Enter Employee Gross income:");
scanf ("%f", &gross_income);

if (marital_status == Married)
if (taxable_income < 5000)
tax = (gross_income - 1100) * 0.00;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
if (taxable_income >= 5000 && taxable_income < 19999)
tax = (taxable_income - 1100) * 0.06;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
if (taxable_income >= 20000 && taxable_income < 36999)
tax = (gross_income - 1100) * 0.09;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
if (taxable_income >= 37000)
tax = (taxable_income - 1100) * 0.16;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
else if (marital_status == NotMarried)
if (taxable_income < 5000)
tax = (gross_income - 650) * 0.00;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
if (taxable_income >= 5000 && taxable_income < 19999)
tax = (taxable_income - 650) * 0.06;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
if (taxable_income >= 20000 && taxable_income < 36999)
tax = (gross_income - 650) * 0.09;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
if (taxable_income >= 37000)
tax = (taxable_income - 650) * 0.16;
net_salary = taxable_income - tax;
printf("
Employee Net salary is %f:", & net_salary);
return 0;
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a void pointer in c?

598


Can static variables be declared in a header file?

606


what is the basis for selection of arrays or pointers as data structure in a program

3780


How can I change their mode to binary?

682


How can a string be converted to a number?

504






Write a program to print “hello world” without using semicolon?

663


What is c language in simple words?

583


What are the advantages of using new operator as compared to the function malloc ()?

744


What does sizeof int return?

580


What is the use of a ‘’ character?

578


What is calloc()?

617


When do we get logical errors?

627


What is array of pointers to string?

556


What are bitwise shift operators in c programming?

632


Explain how do you use a pointer to a function?

631