View the step-by-step solution to:

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.





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("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");


   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");





       case '1': rate1;


       case '2': rate2;


       case '3': rate3;


       case '4': rate4;


       case '5': return 0;





   if(hoursworked > 40)


      overtime = (hoursworked - 40)* rate * overtimerate;

      gross = (40 * rate) + overtimerate;




       gross = hoursworked * rate;




       tax = gross* tax1

   else if(gross <=450)

       tax = gross * tax2;


       tax = gross * tax3;


   net = gross - tax;


   printf("Gross: $%.2f", gross);

   printf("Tax: $%.2f", tax);

   printf("Net: $%.2f", net);


   return 0;



Top Answer

Following is your corrected code: You should define all the constants outside of your main function globally. Then your loop... View the full answer


Sign up to view the full answer

Other Answers

The reason why it is looping at that point is because you have not included the memory allocation script for... View the full answer

The mistake is in the scanning... View the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online