# salary program heeeelp!

This is a discussion on salary program heeeelp! within the C Programming forums, part of the General Programming Boards category; This is a program to calculate salary. (at least to try to=). Well, it is supposed that all the information ...

1. ## salary program heeeelp!

This is a program to calculate salary. (at least to try to=). Well, it is supposed that all the information is given by the user. For the first 40 hours or less the salary is equal to rate * hours. After 40 hours the salary =(additional hours )* (1.5 *rate) rate + (rate*40)
What I am doing wrong???
thanks

#include <stdio.h>

int main()
{
float salary;
int rate, hours;

printf( "Enter # of hours worked (-1 to end): " );
scanf( "%d", &hours );

while ( hours != -1 ){
printf( "Enter hourly rate of the worker (\$00.00): " );
scanf( "%d", &rate );

if ( hours <= 40 )
salary = hours * rate;

else
salary = ( float ) (hours - 40) * (3/2 * rate) + (40 * rate);

printf( "Salary is %.2f\n\n\n", salary );
}

return 0;
}

2. can not understand the reply coz im a begginer.. please can anyone re write the program corrected??

thanks...the assignment is due tomorrow and i need it desperately...
thanks again

3. ## sorry...but....it doesnt work either...

Well, <stdlib.h> is not supposed to appear in my assignment. The program should look like this:

----------------------------------------------------------------------
Enter # of hours of hours worked (-1 to end): 39
Enter hourly rate of the worker (\$00.00): 10.00
Salary is \$390.00

Enter # of hours of hours worked (-1 to end): 41
Enter hourly rate of the worker (\$00.00): 10.00
Salary is \$415.00

Enter # of hours of hours worked (-1 to end): -1
-----------------------------------------------------------------------

can u correct my program to look like this but with only if/else, while, float statements???

sorry but im dumb at this

4. is this exercise from the deitel book?

5. ## instructions

the program instructions are these:
develop a program that will determine the gross pay for each of several employees. The company pays "straight - time " for the 40 hours worked by each employee and pays "time and a half" for all worked in excess of 40 hours. You are given a list of employees of the company, the number of hours each employee worked last week and the hourly rate of each employee. Your program should input this information for each employee, and should determine and display the employee's gross pay.

im frustrated becasue i ve been trying to figure out this for 6 hours! my eyes r bleeding!

6. ## deitel book

yeeees! it is from that damn book. how can they ask for problems with no examples of them! help me plz....

i havent even started to do the other one of the palindrome..i dont want even to think about how many hours i will have to spend tonigh doing it.

7. actually, palindrome is a pretty easy one once you know it. but it stilled bugged me for a whole day at that moment lol.

For your problem, just find the hourly rate per hour and the time and a half rate. Minus the num of hours worked by 40 and times the num of hours over 40 by the time-and - and-half rate and then add it to the product of the hours under 40 and the normal hourly rate. Output that. ...

Popular pages Recent additions