1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <stdio.h>
int age, yrsOfService, countMale, countFemale, countTotal;
float salary, monthlyWage, weeklyWage, severance, severanceTotal;
char gender;
int main()
{
printf("\n\n\n\t\t ***** Pension Calculator *****");
printf("\n\n\t\tPlease enter your Salary: ");
scanf("%f", &salary);
printf("\n\n\t\tPlease enter your Age: ");
scanf("%d", &age);
printf("\n\n\t\tPlease enter Gender (M/F): ");
scanf("%c", &gender);
printf("\n\n\t\tPlease enter Years of Service: ");
scanf("%d", &yrsOfService);
monthlyWage=salary/12;
weeklyWage=salary/52;
if(gender='M' && age>=45 || gender='F' && age>=40)
{
if(gender='M')
{
countMale++;
}
else
{
countFemale++;
}
severance=2*weeklyWage*yrsOfService;
}
else
{
if(gender='M')
{
countMale++;
}
else
{
countFemale++;
}
severance=weeklyWage*yrsOfService;
}
if(severance<monthlyWage)
{
severance=monthlyWage;
}
else
{
}
countTotal=countMale+countFemale;
severanceTotal=severance;
printf("\n\n\t\t\t Number\t Pension");
printf("\n\t\t Male\t %d\t %7.2f", countMale, severance);
printf("\n\t\t Female\t %d\t %7.2f", countFemale, severance);
printf("\n\t\t Total\t %d\n %7.2f", countTotal, severanceTotal);
}
|