Answer to Question #300035 in C for Silas

Question #300035

Rewrite your pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours


1
Expert's answer
2022-02-19T16:56:05-0500


#include<conio.h>
#include<stdio.h>
#include<stdlib.h>




int main(){
	float hours,rate; 
	float overtimePay;
	float grossPay;
	printf("Enter Hours: ");
	scanf("%f",&hours);       
	printf("Enter Rate: ");
	scanf("%f",&rate);
	//Gross Pay = (Hours > 40? 40 X Rate + Overtime pay: Hours x Rate)
	overtimePay = (hours - 40) * rate * 1.5;
	grossPay = (hours > 40 ? 40 * rate + overtimePay : hours * rate);
	printf("\nGross pay: %.2f\n\n", grossPay);


	scanf("%f",&rate);
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS