501,500 views
26 votes
26 votes
Please help I am stuck​

Please help I am stuck​-example-1
User Leola
by
3.1k points

1 Answer

20 votes
20 votes

Answer:

This could take some time to make, but just to get you going I made the first 3 lines. I don't know how to justify the prices to the right, so you probably have to research that.

Step-by-step explanation:

#include <stdio.h>

int 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;

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);

double keyboardTotal = KEYBOARD_PRICE * keyboardQty;

double mouseTotal = MOUSE_PRICE * mouseQty;

double monitorTotal = MOUSE_PRICE * monitorQty;

double printerTotal = PRINTER_PRICE * printerQty;

double speakerTotal = SPEAKER_PRICE * speakerQty;

//double subtotal = ...

printf("%-3s\t%-11s\t%-10s\t%-11s\\", "QTY", "DESCRIPTION", "UNIT PRICE", "TOTAL PRICE");

printf("%-3s\t%-11s\t%-10s\t%-11s\\", "---", "-----------", "----------", "-----------");

printf("%d", keyboardQty);

printf("%-3d\t%-11s\t%-10.2f\t%-11.2f\\", keyboardQty, "KEYBOARD", KEYBOARD_PRICE, keyboardTotal);

}

User Renato Mefi
by
2.7k points