284,494 views
32 votes
32 votes
I need to ask how to type the code for SUBTOTAL , TAX(8.25%), TOTAL

I am stuck can anyone help me tq​

#include<stdio.h>
#pragma warning(disable:4996)

void main() {
const double KEYBOARD_PRICE = 35.50;
const double MOUSE_PRICE = 12.90;
const double MONITOR_PRICE = 600.00;
const double PRINTER_PRICE = 168.00;
const double SPEAKER_PRICE = 120.00;
const double tax = 0.0825;

int keyboardQty, mouseQty, monitorQty, printerQty, speakerQty;
double keyboardTotal, mouseTotal, monitorTotal, printerTotal, speakerTotal,
subtotal, taxCharges, finalTotal;

keyboardTotal = KEYBOARD_PRICE * 10;
mouseTotal = MOUSE_PRICE * 1;
monitorTotal = MOUSE_PRICE * 5;
printerTotal = PRINTER_PRICE * 2;
speakerTotal = SPEAKER_PRICE * 4;

subtotal = keyboardTotal + mouseTotal + monitorTotal + printerTotal + speakerTotal;
taxCharges = subtotal * tax;
finalTotal = subtotal + taxCharges;

printf("Enter the number of items sold:\\");

printf("Keyboard > ");
scanf("%d", &keyboardQty);

printf("Mouse > ");
scanf("%d", &mouseQty);

printf("Monitor > ");
scanf("%d", &monitorQty);

printf("Printer > ");
scanf("%d", &printerQty);

printf("Speaker > ");
scanf("%d", &speakerQty);


printf("%-3s\t%-11s\t%10s\t%-11s\\", "QTY", "DESCRIPTION", "UNIT PRICE", "TOTAL PRICE");
printf("%-3s\t%-11s\t%10s\t%-11s\\", "---", "-----------", "----------", "-----------");
printf("%-3d\t%-11s\t%10.2lf\t%11.2lf\\", 10, "Keyboard", KEYBOARD_PRICE, KEYBOARD_PRICE * 10);
printf("%-3d\t%-11s\t%10.2lf\t%11.2lf\\", 1, "Mouse", MOUSE_PRICE, MOUSE_PRICE * 1);
printf("%-3d\t%-11s\t%10.2lf\t%11.2lf\\", 5, "Monitor", MONITOR_PRICE, MONITOR_PRICE * 5);
printf("%-3d\t%-11s\t%10.2lf\t%11.2lf\\", 2, "Printer", PRINTER_PRICE, PRINTER_PRICE * 2);
printf("%-3d\t%-11s\t%10.2lf\t%11.2lf\\", 4, "Speaker", SPEAKER_PRICE, SPEAKER_PRICE * 4);
printf("%-3s\t%-11s\t%10s\t%-11s\\", " ", " ", " ", "-----------");
printf("%-3s\t%-11s\t%10s\t%-11s\\", " ", " ", "SUBTOTAL ", subtotal);
printf("%-3s\t%-11s\t%10s\t%-11s\\", " ", " ", "TAX (8.25%)", taxCharges);
printf("%-3s\t%-11s\t%10s\t%-11s\\", " ", " ", "TOTAL ", finalTotal);

}

I need to ask how to type the code for SUBTOTAL , TAX(8.25%), TOTAL I am stuck can-example-1
User Rosarito
by
2.9k points

1 Answer

28 votes
28 votes

Answer:

see corrected code in picture.

Step-by-step explanation:

I need to ask how to type the code for SUBTOTAL , TAX(8.25%), TOTAL I am stuck can-example-1
User Mikhail Kholodkov
by
3.0k points