BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/322-object-oriented-programming/)
-   -   Program to enter salary and output income tax and net salary (http://bzupages.com/f322/program-enter-salary-output-income-tax-net-salary-14655/)

bonfire 08-03-2011 11:55 PM

Program to enter salary and output income tax and net salary
 
1 Attachment(s)
Program to enter salary and output income tax and net salary


#include
#include

void main()
{
clrscr();
int itrate;
float salary,itax,nsalary=0;
cout << "Enter the salary : ";
cin>>salary;
if(salary>15000)
{
itax=salary*30/100;
itrate=30;
}
else if(salary>=7000)
{
itax=salary*20/100;
itrate=20;
}
else
{
itax=salary*10/100;
itrate=10;
}
nsalary=salary-itax;
cout << "Salary = $" << salary << endl;
cout << "Your income tax @ " << itrate << "% = $" << itax << endl;
cout << "Your net salary = $" << nsalary << endl;
getch();
}
This program takes in the salary of the employee as a screen input from the user.

It then deducts the income tax from the salary on the following basis :

30% income tax if the salary is above $15000.

20% income tax if the salary is between $7000 and $15000.

10% income tax if the salary is below $7000.

The salary, income tax and the net salary is then outputted using the 'cout' command.

Sample Input 12000
Sample OutputSalary = $12000
Your income tax @ 20% = $2400
Your net salary = $9600


All times are GMT +5. The time now is 09:40 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.