BCSL-021 ASSIGNMENT SOLUTION (2018-19)

If you have any queries please leave a message here
Your Message
×


In this ASSIGNMENT the below PROGRAMMING is written and run in Turbo C++ 3.0

We have removed clrscr( ) and getch( ) functions from this programming because of different version of C compiler.




Question 1 :

Answer : -

/* In this program I assume that all Faculty, Non-Academic Staff, Daily-Wagers or Skilled Workers and Security Personals are permanent central-government employee. Only Consultants are not permanent, they are hire by the University. */
/* This program generate payslip as per central-government pay process */

#include<stdio.h>
/* Global function declaration */
void input();
void payslip();
void calculate_HRA();
void calculate_TA();

/* Global variable declaration */
long BasicPay, GradePay, DA, HRA, TA, CPF;
char *city, category;

/* List of the Grade Pay amount */
long GP[] = { 1800, 1900, 2000, 2400, 2800, 4200, 4600, 4800, 5400, 6600, 7600, 8700, 8900, 10000 };

/* All cities are classified for HRA under X, Y and Z category */
/* List of the cities falling under X category (Population > 50 lakh) */
char X_cities[][15] = { "Hyderabad", "Delhi", "Ahmedabad", "Bengaluru", "Mumbai", "Pune", "Chennai", "Kolkata" };

/* List of the cities falling under Y category (Population between 5 lakh to 50 lakh) */
char Y_cities[][20] = { "Vijaywada", "Warangal", "Visakhapatnam", "Guntur", "Nellore", "Guwahati", "Patna", "Chandigarh", "Durg-Bhilai", "Nagar", "Raipur", "Rajkot", "Jamnagar", "Bhavnagar", "Vadodara", "Surat", "Faridabad" "Gurgaon", "Srinagar", "Jammu", "Jamsedpur", "Dhanbad", "Ranchi", "Bokaro Steel City", "Belgaum", "Hubli-Dharwad", "Mangalore", "Mysore", "Gulbarga", "Kozhikode", "Kochi", "Thiruvanthapuram", "Thrissur", "Mallappuram", "Kannur", "Kollam", "Gwalior", "Indore", "Bhopal", "Jabalpur", "Ujjain", "Amravati", "Nagpur", "Aurangabad", "Nashik", "Bhiwandi", "Solapur", "Kolhapur", "Malegaon", "Nanded-Waghala", "Sangli", "Cuttack", "Bhubaneswar", "Raurkela", "Amritsar", "Jalandhar", "Ludhiana", "Jaipur", " Jodhpur", "Kota", "Ajmer", "Salem", "Tirupur", "Coimbatore", "Tiruchirappalli", "Madurai", "Erode", "Dehradun", "Moradabad", "Ghaziabad", "Agra", "Kanpur", "Lucknow", "Allahabad", "Gorakhpur", "Varanasi", "Noida", "Firozabad", "Jhansi", "Asansol", "Siliguri", "Durgapur" };

/* The remaining cities which are not covered under X or Y category are fallen under Z category where population is less than 5 lakh) */

/* List of the Higher Cities specified for TA */
char cities[][15] = { "Ahmedabad", "Bengaluru", "Chennai", "Coimbatore", "Delhi", "Ghaziabad", "Mumbai", "Hyderabad", "Indore", "Jaipur", "Kanpur", "Kochi", "Kolkata", "Kozhikode", "Lucknow", "Nagpur", "Patna", "Pune", "Surat" };

/* main( ) function */
void main()
{
int choice;
long salary;
while(1)
{
printf("\n PAY SLIP GENERATION \n");
printf("\n 1) Faculty (Asst. Professor, Associate Professor, Professor)");
printf("\n 2) Non-Academic Staff");
printf("\n 3) Consultants");
printf("\n 4) Daily-Wagers / Skilled Workers");
printf("\n 5) Security Personals");
printf("\n 6) Quit");
printf("\n Enter your choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
input();
break;
case 2:
input();
break;
case 3:
printf("\n Enter the Consultants contactual amount : ");
scanf("%ld",&salary);
printf("\n\n\n\t PAY SLIP");
printf("\n\t --------");
printf("\n\n NET AMOUNT \t %ld",salary);
break;
case 4:
input();
break;
case 5:
input();
break;
case 6:
exit(0);
default:
printf("\n WRONG INPUT");
}
}
}

/* Take input from user */
void input()
{
int found=0, i;
/* Input Basic Pay amount */
printf("\n Enter the Basic Pay : ");
scanf("%ld",&BasicPay);
/* Input place (city / village) name where the University is located */
printf("\n Enter the City name where the University is located : ");
fflush(stdin);
gets(city);
/* Input Grade Pay amount */
do
{
printf("\n Enter the Grade Pay : ");
scanf("%ld",&GradePay);
/* Check whether the input Grate Pay value is correct or not */
for(i=0;i<14;i++)
{
if(GradePay == GP[i])
{
found = 1;
break;
}
}
if(found == 0)
printf("\n Wrong Grade Pay value is entered");
}
while(found == 0);
/* payslip( ) function call */
payslip();
}

/* HRA (House Rent Allowance) Calculation */
void calculate_HRA()
{
int found=0, i;
/* If your input city is under X category, then HRA = 24% of Basic Pay. */
for(i=0;i<8;i++)
{
if(strcmp(X_cities[i],city) == 0)
{
HRA = (BasicPay * 24) / 100;
/* The rates of HRA for X category cities will not be less than 5400 */
if(HRA < 5400)
{
HRA=5400;
}
found = 1;
break;
}
}
/* If your input city is under Y category, then HRA = 16% of Basic Pay. */
for(i=0;i<38;i++)
{
if(strcmp(Y_cities[i],city) == 0)
{
HRA = (BasicPay * 16) / 100;
/* The rates of HRA for Y category cities will not be less than 3600 */
if(HRA < 3600)
{
HRA=3600;
}
found = 2;
break;
}
}
/* The remaining cities which are not covered under X or Y category are fallen under Z category */
/* If your input city is under Z category, then HRA = 8% of Basic Pay */
if(found == 0)
{
HRA = (BasicPay * 8) / 100;
/* The rates of HRA for Z category cities will not be less than 1800 */
if(HRA < 1800)
{
HRA=1800;
}
}
}

/* TA (Travelling Allowance) Calculation */
void calculate_TA()
{
int found=0, i;
/* Check whether the input city is under the higher cities (specified for TA) or not. */
for(i=0;i<=18;i++)
{
if(strcmp(cities[i],city) == 0)
{
found = 1;
break;
}
}
if(found == 0)
{
if(GradePay >= 5400)
{
TA=3600;
}
else
if(GradePay >= 2000 && GradePay <= 4800)
{
TA=1800;
}
else
if(GradePay == 1800 || GradePay == 1900)
{
TA=900;
}
}
else
{
if(GradePay >= 5400)
{
TA=7200;
}
else
if(GradePay >= 2000 && GradePay <= 4800)
{
TA=3600;
}
else
if(GradePay == 1800 || GradePay == 1900)
{
TA=1350;
}
}
}

/* Generate Payslip */
void payslip()
{
long gross_amount, net_amount, deduct_amount;
/* Calculate DA from Basic Pay */
DA = (BasicPay * 7) / 100;
/* Functions call */
calculate_HRA();
calculate_TA();
/* Calculate CPF from Basic Pay */
CPF = (BasicPay * 10) / 100;

gross_amount = (BasicPay + DA + HRA + TA);
deduct_amount = (150 + 250 + 30 + CPF);
net_amount = gross_amount - deduct_amount;

printf("\n\n\n\t PAY SLIP");
printf("\n\t --------");
printf("\n DRAWALS");
printf("\n\n BP \t %ld",BasicPay);
printf("\n DA \t %ld",DA);
printf("\n HRA \t %ld",HRA);
printf("\n TA \t %ld",TA);
printf("\n --------------------");
printf("\n TOTAL \t %ld",gross_amount);
printf("\n\n\n DEDUCTIONS");
printf("\n\n PT \t 150");
printf("\n CGHS \t 250");
printf("\n CGEGIS 30");
printf("\n CPF \t %ld",CPF);
printf("\n --------------------");
printf("\n TOTAL \t %ld",deduct_amount);
printf("\n\n\n NET AMOUNT \t %ld",net_amount);
}


Output

PAY SLIP GENERATION

1) Faculty (Asst. Professor, Associate Professor, Professor)
2) Non-Academic Staff
3) Consultants
4) Daily-Wagers / Skilled Workers
5) Security Personals
6) Quit
Enter your choice : 1

Enter the Basic Pay : 45000

Enter the City name where the University is located : Kolkata

Enter the Grade Pay : 4800

PAY SLIP
-----------

DRAWALS

BP45000
DA3150
HRA10800
TA3600
--------------------------------------
TOTAL62550


DEDUCTIONS

PT150
CGHS250
CGEGIS30
CPF4500
--------------------------------------
TOTAL4930


NET AMOUNT57620



ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us