Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- float itemPrice1 = 0, // Represents the item's price
- itemPrice2 = 0, // Represents secondary item price
- itemQuantity1 = 0, // Accounts for the specified quantity of the item
- itemQuantity2 = 0,
- subTotal1 = 0, // Amount prior to taxAmount
- subTotal2 = 0,
- taxAmount = 0, // Percentage ate of 7% or 0.07
- totalAmount = 0, // Accounts for totalAmount including taxAmount
- cashTendered = 0, // Amount given towards totalAmount price
- change = 0; // Deductable given after payment
- // Implementation
- printf("Enter the quantity and price for Paint :");
- scanf("%f %f", &itemQuantity1, &itemPrice1);
- printf("Enter the quantity and price for Blue Brush :");
- scanf("%f %f", &itemQuantity2, &itemPrice2);
- subTotal1 = itemPrice1 * itemQuantity1;
- subTotal2 = itemPrice2 * itemQuantity2;
- taxAmount = 0.07*(subTotal1 + subTotal2);
- totalAmount = subTotal1 + subTotal2 + taxAmount;
- // Program's output results
- printf("Your total is: %.2f\n", totalAmount);
- printf("Enter Changing money\n");
- int cm;
- scanf("%d", &cm);
- int b;
- b = cm;
- float a;
- a= totalAmount;
- printf ("Here is your change %.2f\n", cm-a);
- printf("Thank you for shopping with us!");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement