12-01-2009, 10:31 AM
Hi i am doing a program at the minute i need help because i do not know how to do a bit which i need to do for the program.
Question: update the designs and the program to include overall totals and display these as follows
Number Severance
Male xxx xxxxx.xx
Female xxx xxxxx.xx
Total xxxx xxxxxx.xx
The program which i have coded at the minute is:
#include <stdio.h>
const float afemale=40;
const float amale=45;
const float mmale = 'M' || 'm';
char gender,yn;
float salary,sev,monthly,number,total,tmale,tfemale,tsevm,tsevf,tsev,ot,osev;
int age, years;
main()
{
do
{
printf("\n\n\t\t How old are you? ");
scanf("%d",&age);
getchar();
printf("\n\n\t\t What Gender are you M/F? ");
scanf("%c",&gender);
if(mmale<=sev)
{
tmale=mmale;
}
printf("\n\n\t\t Total salary ");
scanf("%f",&salary);
printf("\n\n\t\t How many years ");
scanf("%d",&years);
getchar();
monthly=salary/12;
if(gender == 'm' && age==amale || gender == 'f' && age==afemale ||
gender == 'M' && age==amale || gender == 'F' && age==afemale)
{
sev = salary/52 *2*years; /* one week *2 = 2 weeks*/
}
else
sev = salary/52*years;
if(sev<monthly)
{
sev=monthly;
}
printf("\n\n\t\t Total %6.2f ",sev);
getchar();
do
{
printf("\n\n\t\t Another sequence Y/N? ");
scanf("%c",&yn);
getchar();
} while(yn!='Y' && yn!='N' && yn!='y' && yn!='n');
} while(yn=='Y' || yn=='y');
{
printf("\n\t number Severance ");
printf("\n\n\t Total male %12.2f \b\b\b %12.2f \b\b\b ",tmale,tsevm);
printf("\n\n\t Total Female %12.2f \b\b\b %12.2f \b\b\b ",tfemale,tsevf);
printf("\n\n\t Total Overall %12.2f \b\b\b %12.2f \b\b\b ",ot,osev);
}
}
Can anybody help me get it to add the full male totals and female + overall total
Question: update the designs and the program to include overall totals and display these as follows
Number Severance
Male xxx xxxxx.xx
Female xxx xxxxx.xx
Total xxxx xxxxxx.xx
The program which i have coded at the minute is:
#include <stdio.h>
const float afemale=40;
const float amale=45;
const float mmale = 'M' || 'm';
char gender,yn;
float salary,sev,monthly,number,total,tmale,tfemale,tsevm,tsevf,tsev,ot,osev;
int age, years;
main()
{
do
{
printf("\n\n\t\t How old are you? ");
scanf("%d",&age);
getchar();
printf("\n\n\t\t What Gender are you M/F? ");
scanf("%c",&gender);
if(mmale<=sev)
{
tmale=mmale;
}
printf("\n\n\t\t Total salary ");
scanf("%f",&salary);
printf("\n\n\t\t How many years ");
scanf("%d",&years);
getchar();
monthly=salary/12;
if(gender == 'm' && age==amale || gender == 'f' && age==afemale ||
gender == 'M' && age==amale || gender == 'F' && age==afemale)
{
sev = salary/52 *2*years; /* one week *2 = 2 weeks*/
}
else
sev = salary/52*years;
if(sev<monthly)
{
sev=monthly;
}
printf("\n\n\t\t Total %6.2f ",sev);
getchar();
do
{
printf("\n\n\t\t Another sequence Y/N? ");
scanf("%c",&yn);
getchar();
} while(yn!='Y' && yn!='N' && yn!='y' && yn!='n');
} while(yn=='Y' || yn=='y');
{
printf("\n\t number Severance ");
printf("\n\n\t Total male %12.2f \b\b\b %12.2f \b\b\b ",tmale,tsevm);
printf("\n\n\t Total Female %12.2f \b\b\b %12.2f \b\b\b ",tfemale,tsevf);
printf("\n\n\t Total Overall %12.2f \b\b\b %12.2f \b\b\b ",ot,osev);
}
}
Can anybody help me get it to add the full male totals and female + overall total