Write a program to create a customer\'s bill for a company. The company tells on
ID: 3628967 • Letter: W
Question
Write a program to create a customer's bill for a company. The company tells only five different products: TV, VCR, Remote Controller, CD Player, and Tape Recorder. The unit prices are $400.00, $220, $35.20, $300.00, and $150.00, respectively. The program must read the quantity of each piece of equipment purchased from the keyboard. It then calculates the cost of each item, the subtotal, and the total cost after an 8.25% sales tax. The input data consist of a set of integers representing the quantities of each item sold. These integers must be input into the program in a user-friendly way, that is, the program must prompt the user for each quantity as shown below. The numbers in boldface show the user's answers. How Many TVs were sold? 3 How Many VCRs were sold? 5 How Many Remote Controllers were sold? 1 How Many CDs were sold? 2 How Many Tape Recorders were sold? 4 The format for the output is shown in Figure 3-13. Use either defined constants or memory constants for the unit prices and the tax rate. Use integer variables to store the quantities for each item. Use floating point variables to store the total price for each item, the bill subtotal, the tax amount, and the total amount of the bill. From your program twice with the following data:Explanation / Answer
please rate - thanks
#include <stdio.h>
#include <conio.h>
int main()
{int tv,vcr,remote,cd,tape;
double ptv,pvcr,premote,pcd,ptape,sub,tax,total;
double tvp=300,vcrp=220,remotep=35.20,cdp=300,tapep=150;
double taxrate=8.25;
printf("How many TVs were sold? ");
scanf("%d",&tv);
printf("How many VCRs were sold? ");
scanf("%d",&vcr);
printf("How many Remote Controllers were sold? ");
scanf("%d",&remote);
printf("How many CDs were sold? ");
scanf("%d",&cd);
printf("How many Tape Recorderss were sold? ");
scanf("%d",&tape);
ptv=tv*tvp;
pvcr=vcr*vcrp;
premote=remote*remotep;
pcd=cd*cdp;
ptape=tape*tapep;
sub=ptv+pvcr+premote+pcd+ptape;
tax=sub*(taxrate/100.);
total=sub+tax;
printf(" ");
printf("QTY DESCRIPTION UNIT PRICE TOTAL PRICE ");
printf("--- ----------- ---------- ----------- ");
printf("%2d TV %10.2f %11.2f ",tv,tvp,ptv);
printf("%2d VCR %10.2f %11.2f ",vcr,vcrp,pvcr);
printf("%2d REMOTE CTRLR %10.2f %11.2f ",remote,remotep,premote);
printf("%2d CD %10.2f %11.2f ",cd,cdp,pcd);
printf("%2d TAPR RECORDER %10.2f %11.2f ",tape,tapep,ptape);
printf(" ----------- ");
printf(" SUBTOTAL %11.2f ",sub);
printf(" TAX %11.2f ",tax);
printf(" TOTAL %11.2f ",total);
getch();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.