Re: C program question

It was late and he takes off for that too, I could have waited another day or 2 and got the 0 for not handing it in, or I can try for the 30 or 40 I may get on that one and take that because I wasn't overly late with it. I wake anything and everything I can get in this class because even 1 month ago I knew I wasn't going to pass it. Now I have a shot. Depending on the midterm and how much he likes it, I know what I got right and didn't, but if he likes what I got right I stand a pretty good chance at passing if I can just come close to passing on the final. I'll take anything I can get on the homework to add a little cushion because while it's not worth much of the final grade, it could make the difference and that 30 or 40 I may get on this one sure beats the 0 I'd get waiting another day to finish it for nothing. I've had classes like that before where that 2 or 3 extra points I shot for when I could made the difference. I hate doing it that way, but you gotta do what you gotta do sometimes. ----- Original Message ----- From: "Ken Perry" <whistler@xxxxxxxxxxxxx>

To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, October 28, 2007 11:08 AM
Subject: RE: C program question




If your turning in code that you have not compiled your not going to get a
passing grade.  Sorry but that's just how it is.

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of John Miller
Sent: Sunday, October 28, 2007 5:26 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: C program question

Thanks. I had to submit it as it was, but hopefully the grade won't be too
bad and I can fix it in time to work on next week's assignment, pointers I
think it is. I guess that's just a case of adding something easy to this
program when it's right so hopefully it won't be too bad and then there's
only 1 more and the final to go. Unless I did worse on the midterm than I
think, then I probably won't bother since I haven't had a decent night's
sleep since the semester started and I think this class is why.

Other personal issues too, but I think this is number 1 reason.
Thanks, I'll definitely work on it with this info and see where I end up.
----- Original Message -----
From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, October 28, 2007 12:20 AM
Subject: RE: C program question


emp.clock
Where you have
struct emp



You should define the structure like

struct Employee{
int Clock;
float wage;
float hoursWorked;
}


Where you have

struct employee emp(5);

You should have

Struct Employee emp[5];

Then the rest should work better or at least give you errors you
understand.

Ken






-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of John Miller
Sent: Saturday, October 27, 2007 5:01 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: C program question

If I actually include the code, I think you can help me better. Sorry, I
didn't sleep last night.

#include <stdio.h>

/* function prototypes */

void initData(int *clockNumberPtr,float *wagePtr,float *hoursWorkedPtr);

void getHoursWorked(int entry,int * clockNumberPtr,float *hoursWorkedPtr);

float calculateOverTime(int entry, float *wagePtr,float *hoursWorkedPtr);

float calculateGrossPay(int entry, float *wagePtr,float *hoursWorkedPtr);

void displayEntry(int entry, int *clockNumberPtr,float *wagePtr,float
*hoursWorkedPtr);

struct emp

int main (char *argv, int argc)

{ /*get clock info*/

int clockNumber; /*employee number*/

float wage; /* declare wage */

float hoursWorked; /*enter hours worked*/

struct employee emp(5);

int i=0;//index for for loop

initData(clockNumber,wage,hoursWorked);

for (i=0;i<5;i++)

getHoursWorked(i,clockNumber,hoursWorked);

printf("Clock #\tWAge\thours\tOver time\tGross Pay\n");

for (i=0;i<5;i++)

displayEntry(i,clockNumber,wage,hoursWorked);

struct emp myempArray[5];

return(0);

} /*end get clock info*/



void initData(int *clockNumberPtr,float *wagePtr,float *hoursWorkedPtr)

{ /* declaring clock numbers and wage*/

int i; // index for for loop

emp[0].clockNumber=98401 ; /*first employee*/

emp[1].clockNumber=526488; /* second employee*/

emp[2]clockNumber=765349; /*third employee */

emp[3]clockNumber=34645; /*forth employee*/

emp[4]clockNumber=127615; /*fifth employee */

emp[0]wage=10.60; /* first employee wage

emp[1]wage=9.75; /*second employee wage

emp[2]wage=10.50; /* third employee wage */

emp[3]wage=12.25; /*employee 4 wage */

emp[4]wage=8.35; /* fifth employee wage 8/

// init hours worked to 0

for (i=0;i<5;i++)

hoursWorkedPtr[i]=0;

} /*end declaring clock and wage numbers*/

void getHoursWorked(struct employee emp[])

{ /*prompt for hours*/

printf ("Enter hours worked by %d: ",clockNumberPtr[entry]);

scanf_s("%f", &(hoursWorkedPtr[entry]));

} /*end prompt for hours*/

float calculateOverTime(int entry, float *wagePtr,float *hoursWorkedPtr)

{ /* figure out overtime */

float overTimeHours=hoursWorkedPtr[entry]-40;

float overTimePay=0;

if (overTimeHours>0)

overTimePay=overTimeHours*(wagePtr[entry]*1.5);

return (overTimePay);

} /* end figuring out overtime */



float calculateGrossPay(int entry, float *wagePtr,float *hoursWorkedPtr)

{ /* determine gross pay*/

float grossPay=0;

if (hoursWorkedPtr[entry]>40)


grossPay=(40*wagePtr[entry])+calculateOverTime(entry,wagePtr,hoursWorkedPtr)
;

else

grossPay=wagePtr[entry]*hoursWorkedPtr[entry];

return (grossPay);

} /*end determine gross pay */

void displayEntry(int entry, int *clockNumberPtr,float *wagePtr,float
*hoursWorkedPtr)

{ /*desplay results */

printf ("%d\t%0.2f\t%0.2f\t%0.2f\t%0.2f\n",

emp.clockNumber,

emp.wage,

emp.hoursWorked,

calculateOverTime(entry,wagePtr,hoursWorkedPtr),

calculateGrossPay(entry,wagePtr,hoursWorkedPtr));

} /* end desplay output*/

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at http://www.freelists.org/list/programmingblind

Other related posts: