Ok, I don't think I have solved it yet, but I'm working on it. This is what my code looks like so far.
23 #include<stdio.h>
24
25
26 int main()
27 {
28 int tv; //The number of Televisions bought by the consumer
29 int bluRay; //The number of Blu-Ray Players bought by the consumer
30 int remote; //The number of Remote Controls bought by the consumer
31 int mp3; //The number of MP3 Players bought by the consumer
32 int laptop; //The number of Laptop Computers bought by the consumer
33
34 float tvTotal; //The total price of Televisions bought
35 float bluRayTotal; //The total price of Blu-Ray Players bought
36 float remoteTotal; //The total price of Remote Controls bought
37 float mp3Total; //The total price of MP3 Players bought
38 float laptopTotal; //The total price of Laptop Computers bought
39
40 float subtotal; //The total price of all purchases without tax
41 float subtotalTax; //The toal price of all purchases including tax
42 float total; //The total price includiding tax
43
44 printf("\n");
45 printf("Enter quantity of televisions: ");
46 scanf("%d", &tv); //Takes the number from the user and saves it in variable tv
47
48 printf("Enter the quantity of Blu-ray players: ");
49 scanf("%d", &bluRay); //Takes the number from the user and saves it in variable bluRay
50
51 printf("Enter quanitity of remote controls: ");
52 scanf("%d", &remote); //Takes the number from the user and saves it in variable remote
53
54 printf("Enter quantity of MP3 players: ");
55 scanf("%d", &mp3); //Takes the number from the user and saves it in variable mp3
56
57 printf("Enter quantity of laptops: ");
58 scanf("%d", &laptop); //Takes the number from the user and saves it in variable laptop
59
60
61 tvTotal = tv * 599.99; //Calculates the total price of television using the unit price
62 bluRayTotal = bluRay * 199.99; //Calculates the total price of bluRay Players using the unit price
63 remoteTotal = remote * 29.99; //Calculates the total price of remote controls using the unit price
64 mp3Total = mp3 * 44.99; //Calculates the total price of MP3 Players using the unit price
65 laptopTotal = laptop * 349.99; //Calculates the total price of laptops using the unit price
66
67 subtotal = tvTotal + bluRayTotal + remoteTotal + mp3Total + laptopTotal; //Calculates the subtotal using the total prices of all objects bought
68 subtotalTax = subtotal * .07; //Calculates the sales tax of 7% of the total merchandise
69 total = subtotal + subtotalTax; //Adds the tax to the subtotal to arrive with the total price the consumer owes the seller
70
71 printf("\nQTY DESCRIPTION UNIT PRICE TOTAL PRICE");
72 printf("\n--- ----------- ---------- -----------");
73 printf("\n%3d Televisions $ 599.99 $%10.2f", tv, tvTotal); //Prints the quantity of electronics bought and t he total price of those electronics(next four lines including current)
74 printf("\n%3d Blu-ray Players $ 199.99 $%10.2f", bluRay, bluRayTotal);
75 printf("\n%3d Remote Controls $ 29.99 $%10.2f", remote, remoteTotal);
76 printf("\n%3d MP3 Players $ 44.99 $%10.2f", mp3, mp3Total);
77 printf("\n%3d Laptop Computers $ 349.99 $%10.2f", laptop, laptopTotal);
78 printf("\n%35c----------", '-');
79 printf("\n%25cubtotal $%10.2f", 'S', subtotal);
80 printf("\n%30cax $%10.2f", 'T', subtotalTax);
81 printf("\n%28cotal $%10.2f", 'T', total);
82 printf("\n\n");
83
84 return(0);
85 }
Edited by altair05, 07 February 2011 - 09:29 PM.