I'm just doing whatever I know but.... I don't know how to make it appear like the output the question need
So, this is the question
Write a program to create a customer’s bill for a company. The company sells five computer gadgets which are CD, keyboard, printer, pen drive and speaker. The unit prices are RM60.00 per pack, RM130.00, RM850.00, RM65.00 and RM72.50 respectively. The program must require user to input quantity of each piece of equipment purchased. It then calculates the cost of each item, the sub total, and the total cost after 3% sales tax. List of formula as stated below:
Total price = quantity * unit price (Note: for each item)
Sub total = total price of all item
Tax = 3% of sub total
Total = sub total + tax
The input data consist of a set integer representing the quantities of each item sold.
Example pf the input is shown below:
amount of CDs (per pack): 5
amount of keyboards : 120
amount of printers : 35
amount of pen drives : 236
amount of speakers : 83
The format for the output is as below:
1 2 3 4 5 6 7 8 9 10 11
|
QTY DETAILS UNIT PRICE TOTAL PRICE
______ ________ ____________ ____________
XX CD 60.00 XXXX.XX
XX KEYBOARD 130.00 XXXX.XX
XX PRINTER 850.00 XXXX.XX
XX PEN DRIVE 65.00 XXXX.XX
XX SPEAKER 72.50 XXXX.XX
____________
SUB TOTAL XXXX.XX
TAX XXXX.XX
TOTAL XXXX.XX
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Put the code you need help with here.
#include <iostream.h>
#include <conio.h>
int main()
{ float pCD,pkey,pprint,ppen,pspeak,qCD,qkey,qprint,qpen,qspeak,sub,tax,total;
cout<<"QTY DETAILS UNIT PRICE TOTAL PRICE \n";
cout<<"____ ______ _________ __________________\n";
cin>>qCD;
pCD=qCD*60.00;
cout<<" CD 60.00 "<<pCD<<endl;
cin>>qkey;
pkey=qkey*130.00;
cout<<" KEYBOARD 130.00 "<<pkey<<endl;
cin>>qprint;
pprint=qprint*850.00;
cout<<" PRINTER 850.00 "<<pprint<<endl;
cin>>qpen;
ppen=qpen*65.00;
cout<<" PEN DRIVE 65.00 "<<ppen<<endl;
cin>>qspeak;
pspeak=qspeak*72.50;
cout<<" SPEAKER 72.50 "<<pspeak<<endl;
sub=pCD+pkey+pprint+ppen+pspeak;
tax=0.03*sub;
total=sub+tax;
cout<<" __________________\n";
cout<<" SUB TOTAL "<<sub<<endl;
cout<<" TAX "<<tax<<endl;
cout<<" TOTAL "<<total<<endl;
getch();
}
|