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
#2
Sounds like homework to me:

"Question: update the designs and the program to include overall totals and display these as follows "

I'm not sure what the forums policy is on homework questions..
Slackware 13/ArchLinux - C/Assem/Python
Reply
#3
Not sure, my policy is "no", especially when they don't use code tags to keep the formatting somewhat decent Smile
[Image: sig.php]
The little boat gently drifted across the pond exactly the way a bowling ball wouldn't.
Reply
#4
(12-01-2009, 02:39 PM)g4143 Wrote: Sounds like homework to me:

"Question: update the designs and the program to include overall totals and display these as follows "

I'm not sure what the forums policy is on homework questions..
Hey! It's called SUPPORT Forums for a reason. The forum rules have nothing against it and people have been helped with homework before on this forum and the admins/mods didn't complain. In this case it's really up to the individual, I personally think that if people do it on their own they actually learn.
[Image: izsyo6.jpg]


Reply
#5
(12-02-2009, 07:07 PM)uber1337 Wrote: Hey! It's called SUPPORT Forums for a reason. The forum rules have nothing against it and people have been helped with homework before on this forum and the admins/mods didn't complain. In this case it's really up to the individual, I personally think that if people do it on their own they actually learn.

Yes the word is "helped", I have no problems helping someone who has a specific question but to post a assignment question and ask someone to solve it well that's different..
Slackware 13/ArchLinux - C/Assem/Python
Reply
#6
Also, under academic law it counts as plagiarism to get someone else to do your work for you. So all in all, it's not a good idea.

Asking for help with an aspect of something is one thing, asking for a complete solution is completely different.
[Image: sig.php]
The little boat gently drifted across the pond exactly the way a bowling ball wouldn't.
Reply
#7
sorry i kinda put it a bit wrong i wanted like help but not for you to do the whole program just where do i put the calculations and the end statement but never mind i done it now + it doesn't matter aslong as i understand the stuff Big Grin

but thanks anyhow next time ill post but only ask for help as in guideness sorry that i put it wrong terms really
Smile
Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)