Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Could anyone please solve this problem because I have no idea howto do it the pr

ID: 3614250 • Letter: C

Question

Could anyone please solve this problem because I have no idea howto do it
the problem is
A music store needs a program to implement its music teacher'sdiscount policy. The program in file music.c is to promptthe user to enter the purchase total and to indicate whether thepurchaser is a teacher. The store plans to give each customer aprinted receipt, so your program is to create a nicely formattedfile called receipt.txt. Music teachers receive a 10%discount on their sheet music purchases unless the purchase totalis $100 or higher. in that case, the discount is 12%. The discountcalculation occurs before addition of the 7% sales tax. Yourprogram should use functions to display instructions to the userand to compute the discount, if any. Here is a sample output, for ateacher. Total purchases $122.00 Teacher's discount (12%) 14.64 Discounted total 107.36 Sales tax (7%) 7.52 Total 114.88
Here is a sample output, for a nonteacher. Total purchases $24.90 Sales tax (7%) 1.74 Total 26.64

Total purchases $122.00 Teacher's discount (12%) 14.64 Discounted total 107.36 Sales tax (7%) 7.52 Total 114.88

Explanation / Answer

please rate - thanks #include #include int main() {int teacher; double total,discount,tax,rate; FILE *out; out=fopen("receipt.txt","w"); if(out==NULL)     {printf("Error opening output file! ");     getch();      return 0;     }     printf("Are you a teacher? ");     printf("Enter 1 for yes, anything else for no:");     scanf("%d",&teacher);     printf("Enter total purchase: ");     scanf("%lf",&total);     if(teacher==1)         {if(total>=100)            rate=12.;         else            rate=10.;         }     fprintf(out," Totalpurchases               $%6.2lf ",total);     if(teacher==1)        {discount=total*(rate/100.);         fprintf(out,"Teacher's discount (%.0lf%%)   %6.2lf ",rate,discount);         total-=discount;         fprintf(out,"Discountedtotal                %6.2lf ",total);          }      tax=total*(7/100.);      fprintf(out,"Sales tax(7%%)                   %6.2lf ",tax);     fprintf(out,"Total                               %6.2lf ",total+tax); fclose(out); return 0; }