Question

amming Projects 1. Keiths Sheet Music needs a program to implement its music teachers dis- count policy. The program is to

Total purchases $122.00 Teachers discount (128) 14.64 Discounted total 107.36 Sales tax (5%) 5.37 Total $112.73 Total purcha

0 0
Add a comment Improve this question Transcribed image text
Answer #1

c code :

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
float total_purchase,amount,discount,dis_amount=0,sales_tax=0;
char str[40];
printf("Enter total purchase Amount\n");
scanf("%f",&total_purchase);
/*confirming whether the customer is a teacher or not*/
printf("Whether the customer is a teacher(y or n)\n");
scanf("%s",&str);
if(strcmp(str,"y")==0){
if (total_purchase >= 100){
discount = 0.12 * total_purchase;}
else{
discount = 0.10 * total_purchase;}
/*calculate total discount amount for the customer*/
dis_amount = total_purchase - discount;
/*calculate sales tax for the music teacher*/
sales_tax = 0.05 * dis_amount;
/*calculate total amount*/
amount = dis_amount + sales_tax;}

/*Display receipt*/
if(strcmp(str,"y")==0){
printf("Total purchases :$%.2f\n",total_purchase);
printf("Teacher's discount(12%%) :%.2f\n",discount);
printf("Discounted total :%.2f\n",dis_amount);
printf("Sales tax(5%%) :%.2f\n",sales_tax);
printf("____________________________\n");
printf("Total :$%.2f\n",amount);}
else{
printf("Total purchases :$%.2f\n",total_purchase);
sales_tax = 0.05 * total_purchase;
printf("Sales tax(5%%) :%.2f\n", sales_tax);
printf("______________________________\n");
printf("Total is :%.2f\n",
total_purchase + sales_tax);}
getch();
return 0;
}

c code sample screenshot:

Open A 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 int main() { 5 float total_purchase, amount, discount,

output screenshot

Enter total purchase Amount 122 Whether the customer is a teacher(y or n) Total purchases : $122.00 Teachers discount(12%) :

Enter total purchase Amount 122 Whether the customer is a teacher(y or n) Total purchases : $122.00 Sales tax(5%) :6.10 Total

//comment if u need further help

//please upvote happy learning

Add a comment
Know the answer?
Add Answer to:
amming Projects 1. Keith's Sheet Music needs a program to implement its music teacher's dis- count...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • CASE 1-5 Financial Statement Ratio Computation Refer to Campbell Soup Company's financial Campbell Soup statements in...

    CASE 1-5 Financial Statement Ratio Computation Refer to Campbell Soup Company's financial Campbell Soup statements in Appendix A. Required: Compute the following ratios for Year 11. Liquidity ratios: Asset utilization ratios:* a. Current ratio n. Cash turnover b. Acid-test ratio 0. Accounts receivable turnover c. Days to sell inventory p. Inventory turnover d. Collection period 4. Working capital turnover Capital structure and solvency ratios: 1. Fixed assets turnover e. Total debt to total equity s. Total assets turnover f. Long-term...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT