Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with programming C
#1
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 Big Grin
Reply


Messages In This Thread
Help with programming C - by z3rO88 - 12-01-2009, 10:31 AM
RE: Help with programming C - by g4143 - 12-01-2009, 02:39 PM
RE: Help with programming C - by MrD. - 12-01-2009, 04:09 PM
RE: Help with programming C - by uber1337 - 12-02-2009, 07:07 PM
RE: Help with programming C - by g4143 - 12-03-2009, 09:14 AM
RE: Help with programming C - by MrD. - 12-03-2009, 10:38 AM
RE: Help with programming C - by z3rO88 - 12-04-2009, 01:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is c++ The Best Programming Language to Learn some of Java schneweis 23 5,424 08-07-2011, 11:14 AM
Last Post: [Dr.House]
  Programming Team Project lil PopTart kid 10 2,770 01-16-2010, 05:27 PM
Last Post: J4P4NM4N
  Why are all the functions in programming languages English? nevets04 13 2,938 11-09-2009, 06:07 PM
Last Post: J4P4NM4N

Forum Jump:


Users browsing this thread: 1 Guest(s)