Thursday, August 18, 2011

Simple Payrol System using IF Statement

Sample Layout
Turbo C Program that will compute for the net income of a particular employee. you have to accept name, position, and number of hours worked.








Click Read More for the code:







#include <conio.h>
#include <stdio.h>
#define g gotoxy
#define s scanf
#define p printf

main()
{
clrscr();
char name,position;
int no,gross,Tax,Medicare,SSS,rate,bonus,TD,NI;

g(1,1);p("Name:");
g(30,2);p("Position:");
g(30,3);p("<m>Manager");
g(45,4);p("<s>Supervisor");
g(60,5);p("<e>Employee");
g(1,4);p("Rate:");
g(1,5);p("No. of Hours Worked:");
g(1,6);p("Gross:");
g(1,7);p("--------------------------------");
g(1,9);p("Bonus:");
g(30,11);p("Deduction :");
g(30,13);p("Tax:");
g(30,14);p("SSS:");
g(30,15);p("Medicare:");
g(30,16);p("Total Deduction:");
g(1,18);p("Net Income:");
g(1,20);p("XxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX");
g(7,1);s("%s",&name);
g(22,5);s("%d",&no);
g(42,1);s("%s",&position);
position=getche();
if (position=='m')
{
g(22,4);p("500");
g(22,5);s("%d",&no);
gross=no*500;
g(22,6);p("%d",gross);
}
else if (position=='s')
{
g(22,4);p("400");
g(22,5);s("%d",&no);
gross=no*400;
g(22,6);p("%d",gross);
}
else if (position=='e')
{
g(22,4);p("300");
g(22,5);s("%d",&no);
gross=no*300;
g(22,6);p("%d",gross);
}
else
{
g(22,4);p("NONE");
}

if (gross>=8000)
{
g(22,9);p("1000");
}
else if (gross>=5000)
{
g(22,9);p("750");
}
else if (gross>=3000)
{
g(22,9);p("500");
}
else
{
g(22,9);p("NO BONUS!");
}

SSS=gross*.10;
g(50,14);p("%d",SSS);
g(50,15);p("100");

if (gross>=7000)
{
Tax=gross*.15;
g(50,13);p("%d",Tax);
}
else if (gross>=4000)
{
Tax=gross*.10;
g(50,13);p("%d",Tax);
}
else if (gross>=2000)
{
Tax=gross*.5;
g(50,13);p("%d",Tax);
}
TD=Tax+SSS+100;
g(50,16);p("%d",TD);

if (gross>=8000)
{
NI=(gross+1000-TD);
g(15,18);p("%d",NI);
}
else if (gross>=5000)
{
NI=(gross+750-TD);
g(15,18);p("%d",NI);
}
else if (gross>=3000)
{NI=(gross+500-TD);
}
else
{
g(15,18);
}


getch();
return 0;


}


2 comments:

  1. nice code for programming turbo c, i can learned this.. :) its really helpful.
    good job!

    ReplyDelete
  2. what are the tables to be used

    ReplyDelete

Watch Miss Universe 2011

Watch live streaming video from missuniverse at livestream.com

Play Games - Fantastic Contraption

Advertise Here

New Post