Answered You can hire a professional tutor to get the answer.
Please choose an option between 1-5 no matter what selection I choose.
I cannot get my assignment to stop looping "Incorrect selection. Please choose an option between 1-5" no matter what selection I choose. I feel like I am really close but something is definitely wrong.
CODE IS AS FOLLOWS:
#include<stdio.h>
int main(void)
{
int choice;
int hoursworked;
#define rate1 8.75;
#define rate2 9.33;
#define rate3 10.00;
#define rate4 11.20;
#define tax1 0.15;
#define tax2 .2;
#define tax3 .25;
#define overtimerate 1.5;
float rate, hours, gross, tax, net, overtime;
printf("*******************************************************************n");
printf("Enter the number corresponding to the desired pay rate or action:n");
printf("1) $8.75/hr 2) $9.33/hrn");
printf("3) $10.00/hr 4) $11.20/hrn");
printf("5) quitn");
printf("*******************************************************************n");
scanf("%d, &choice");
while(choice <1 || choice >5)
{
printf("Incorrect selection. Please choose an option between 1-5n");
}
if(choice > 1 || choice < 5)
{
printf("Enter amount of hours worked this week.n");
scanf("%d, &hoursworked");
}
switch(choice)
{
case '1': rate1;
break;
case '2': rate2;
break;
case '3': rate3;
break;
case '4': rate4;
break;
case '5': return 0;
break;
}
if(hoursworked > 40)
{
overtime = (hoursworked - 40)* rate * overtimerate;
gross = (40 * rate) + overtimerate;
}
else
{
gross = hoursworked * rate;
}
if(gross<=300)
tax = gross* tax1
else if(gross <=450)
tax = gross * tax2;
if(gross>450)
tax = gross * tax3;
net = gross - tax;
printf("Gross: $%.2f", gross);
printf("Tax: $%.2f", tax);
printf("Net: $%.2f", net);
return 0;
}