Im a beginner and i need help on an assignment due at midnight.
1) Find workers pay if rate is $9.00 and they get overtime (1.5x) after 40 hours
Code:
#include <stdio.h>
int main(){
int hours;
double pay;
printf("Enter the number of hours: \n");
scanf("%d", &hours);
if(hours>40){
pay = hours*9.00*1.5;
}
else if(hours<=40){
pay = hours*9.00;
}
printf("Your pay is %.2f", &pay);
return 0;
}
This first one returns $0.00 no matter how many hours you put in.
2) Write program that will transcript message based on GPA
0-0.99 Failed
1-1.99 Suspended
2-2.99 no message
3-3.5 dean's list
4-4.0 highest scholar award
Code:
#include <stdio.h>
int main(){
double GPA;
printf("Enter your GPA: \n");
scanf("%d", GPA);
if(GPA <= 4.0 && GPA >= 3.5)
printf("Highest honors for semester\n");
else if(GPA < 3.5 && GPA >= 3.0)
printf("Dean's list for semester\n");
else if(GPA < 3.0 && GPA >= 2.0)
printf("\n");
else if(GPA < 2.0 && GPA >= 1.0)
printf("On probation for next semester\n");
else if(GPA < 1.0)
printf("Failed semester - Registration suspended\n");
return 0;
}
This one always returns the last line even if you put in a 4.0 GPA for example