I am in need of more advice, my program is working but I am not geting the answer that I got by calculation that I should have gotten in the program. would someone tell me what I am doing wrong with the coding on my math function. Second to last line of code.
Code:
#include <stdio.h>
int main(void)
{
char name[30];
int pay = 0; /*selected from case group by alph corispondant # */
int hours = 0; /*user input with if elas statments */
int hlhrs = 0; /*user input in conjunction with the if eals statments */
int ot = 0; /*mathmatical calculation with in the if eals than statments */
int othol = 0; /*mathmatical calculation with in the if eals than statments */
int check = 0; /*total amount of pay for the week */
printf("What is your Name?");
scanf("%s", name);
printf("Good Day to you %s.");
printf("Please chose one of the following choses so we know the amount of your hourly pay.\n");
printf("1 : $10.00 an hour.");
printf("2 : $20.00 an hour.");
printf("3 : $30.00 an hour.");
printf("4 : $50.00 an hour.");
scanf("%d", pay);
switch (pay) {
case 1:
pay = 10;
break;
case 2:
pay = 20;
break;
case 3:
pay = 30;
break;
case 4:
pay = 50;
break;
default:
pay = 10;
break;
}
// Section 2.0 = input of hours worked
printf("So How many Hours did you work?");
scanf("%d", hours);
if (hours <= 40); /*!! what's this ; doing here? */
{
check = pay * hours;
printf("Your pay this week will be $", check);
}
eals if (hours > 40);
{
printf("How many Holiday and Sunday Hours did you have? IF any!");
scanf("%d", &hlhrs);
printf("How many Overtime hours did you work? If any!");
scanf("%d", &ot);
}/* end if eals */
check = ((hlhrs * 2) + (ot * 1.5) + (hours - (hlhrs + ot)));
printf("Your pay this week will be $", check);
}// end of program