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

<p>Write a program to create a customers bill for a company. the company sells o

ID: 3628943 • Letter: #

Question

<p>Write a program to create a customers bill for a company. the company sells only TV, VCR, remote controller, CD player and tape recorder. the prices are $400, 220, 35.20, 300 and 150 respectively. The program must read the quantity of each piece of equipment purchased from input on the keyboard. it then calculates the cost of each item, the subtotal and total cost after 8.25% sales tax. The input data is 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. the numbers in bold face show the users answers:<br /><br />How many TVs were sold? <strong>3</strong></p>
<p>and so forth for each item. 3 tvs in just an example.&#160; the format for output is as below:</p>
<p>QTY&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Description&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Unit Price&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Total Price&#160;&#160;&#160;</p>
<p>-----&#160;&#160;&#160;&#160;&#160;&#160;&#160; --------------&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;---------&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -------------</p>
<p>xx&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TV&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 400.00&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xxxx.xxx</p>
<p>xx&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; VCR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;220.00&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xxx.xx</p>
<p>ect. for each type of device.</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ------------</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; subtotal&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xxx.xx</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tax&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;xxx.xx</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Total&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; xxxx.xx</p>
<p>Thanks, I am so lost on this.</p>
<p>&#160;</p>

Explanation / Answer

// code goes as follows.....

#include <stdio.h>

#define TV 400.00

#define DVD 220.00

#define REMOTE 35.20

#define CD 300.00

#define STEREO 450.00

#define TAX 0.0625

int main (void)

{

int numTVs, numDVDs, numRemotes, numCDs, numStereos;

double subTotal;

/*Get user input for number of items sold*/

// and store it in used variables...

printf("How many TVs were sold? ");

scanf("%d",&numTVs);

printf("How many DVDs were sold? ");

scanf("%d",&numDVDs);

printf("How many Remotes were sold? ");

scanf("%d",&numRemotes);

printf("How many CDs were sold? ");

scanf("%d",&numCDs);

printf("How many Stereos were sold? ");

scanf("%d",&numStereos); subTotal=numTVs*TV+numDVDs*DVD+numRemotes*REMOTE+numCDs*CD+numStereos*STEREO;

/*Output bill of sale*/

// strart printing output ................

printf(" ==================================================== ");

printf("QTY DESCRIPTION UNIT PRICE TOTAL PRICE ");

printf("---------------------------------------------------- ");

printf("%3d %s %10.2f %11.2f ",numTVs," Television",TV,numTVs*TV);

printf("%3d %s %10.2f %11.2f ",numDVDs," DVD Player",DVD,numDVDs*DVD);

printf("%3d %s %10.2f %11.2f ",numRemotes,"Remote Ctrl",REMOTE,numRemotes*REMOTE);

printf("%3d %s %10.2f %11.2f ",numCDs," CD Player",CD,numCDs*CD);

printf("%3d %s %10.2f %11.2f ",numStereos," Stereo Rec.",STEREO,numStereos*STEREO);

printf("---------------------------------------------------- ");

printf(" SUBTOTAL %11.2f ",subTotal);

printf(" TAX %11.2f ",subTotal*TAX); printf(" ------------ ");

printf(" TOTAL %11.2f ",subTotal+subTotal*TAX);

printf("==================================================== ");

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote