Hi, I'm trying to write a code to ask for and display a person's salary under these conditions:
"If the hours worked are less than or equal to 40, the person receives $8.00 per hour; otherwise, the person receives $320.00 plus $12.00 for each hour worked over 40 hours."
I have the first part down, the only thing I'm not sure how to do is the whole "$12.00 for each hour worked OVER 40 hours." Any ideas?
Here's what I have so far,
Code:
#include <stdio.h>
void main ()
{
double hour;
double salary;
printf("Please enter the number of hours you work each week\n");
scanf("%lf", &hour);
if(hour <= 40)
{
salary = 8.00 * hour;
printf("Your weekly salary is $%5.2lf.\n", salary);
}
else
{
salary = 320.00 + (12.00 * hour);
printf("Your weekly salary is $%5.2lf.\n", salary);
}
}