GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 23-Sep-2003, 18:20
arek arek is offline
New Member
 
Join Date: Sep 2003
Posts: 1
arek is an unknown quantity at this point

Payroll program


so im writing this small program in C and im having trouble with it. here it is:
CPP / C++ / C Code:
/*WEEKLY PAYROLL OF MANAGERS AND N0N-MANAGERS
 *NAME: Arkadiusz Jaworski
 *CORE: 1.5
 *DATE: 09/24/2003
 */

#include <stdio.h>
int main ()
{
	  int id, status=0, numberemps=0;
	  double hours, rate, weeklypay, dues, netpay;
	  FILE *output;
	  output=fopen ("a:assn2output.out","w");

	  printf ("please enter ID#, -1 to stop > ");
	  scanf ("%d", &id);
	  while (id!=-1){
	  		 printf ("enter status. 1 for manager, 0 for non-manager > ");
			 scanf ("%d", &status);{
			 if (status==0)
					printf ("nonmanager");
			 if (status==1)
					printf ("manager");}
			 printf ("enter hours > ");
			 scanf ("%lf", &hours);
			 printf ("enter rate of pay > ");
			 scanf ("%lf", &rate);
			 if (hours > 40)
					weeklypay=40*rate+(hours-40)*1.5*rate;
			 else
					weeklypay=hours*rate;
			 if (status==0)
					dues=weeklypay-(weeklypay-15);
			 if (status==1)
					dues=weeklypay*.1;
			 netpay=weeklypay-dues;
			 fprintf (output, "Employee %d worked %.1f hours at $%.2f - %d\n", id, hours, rate, status);
			 fprintf (output, "Weekly pay $%.2f   Dues $%.2f   Net Pay $%.2f\n\n\n", weeklypay, dues, netpay);
			 numberemps++;
			 printf ("please enter ID#, -1 to end > ");
			 scanf ("%d", &id);
}
	  fprintf (output, "%d employees were processed", numberemps);
	  fclose (output);
	  return 0;
}

so then i put the values for prompt.....

and the outout is like that for example:


employee 123 worked 46.0 hours at $6.50 per hour 1
weekly pay $318.50 dues $31.85 net pay $286.65


employee 433 worked 46.0 hours at $6.50 per hour 1
weekly pay $318.50 dues $31.85 net pay $286.65


employee 453 worked 46.0 hours at $6.50 per hour 0
weekly pay $318.50 dues $31.85 net pay $286.65


employee 574 worked 46.0 hours at $6.50 per hour 0
weekly pay $318.50 dues $31.85 net pay $286.65



-----
do u see where i put highlighted with bold text?
in that place i want for value od status=0 to prin in that place NONMANAGER and for status=1 >> MANAGER

so here is how i want it to be:

employee 123 worked 46.0 hours at $6.50 per hour manager
weekly pay $318.50 dues $31.85 net pay $286.65


employee 433 worked 46.0 hours at $6.50 per hour manager
weekly pay $318.50 dues $31.85 net pay $286.65



----
of course with different values for hours and rate....

anyone can help me? thanx in advance
 
 

Recent GIDBlogWelcome to Baghdad by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:41.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.