Advertisement
kalponikoronno

cr

Mar 25th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.37 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.  
  5.     float itemPrice1 = 0, // Represents the item's price
  6.           itemPrice2 = 0, // Represents secondary item price
  7.           itemQuantity1 = 0, // Accounts for the specified quantity of the item
  8.           itemQuantity2 = 0,
  9.           subTotal1 = 0, // Amount prior to taxAmount
  10.           subTotal2 = 0,
  11.           taxAmount = 0, // Percentage ate of 7% or 0.07
  12.           totalAmount = 0, // Accounts for totalAmount including taxAmount
  13.           cashTendered = 0, // Amount given towards totalAmount price
  14.           change = 0; // Deductable given after payment
  15.  
  16. // Implementation
  17.  
  18.     printf("Enter the quantity and price for Paint :");
  19.     scanf("%f %f", &itemQuantity1, &itemPrice1);
  20.     printf("Enter the quantity and price for Blue Brush :");
  21.     scanf("%f %f", &itemQuantity2, &itemPrice2);
  22.  
  23.  
  24.  
  25.  
  26.     subTotal1 = itemPrice1 * itemQuantity1;
  27.     subTotal2 = itemPrice2 * itemQuantity2;
  28.     taxAmount = 0.07*(subTotal1 + subTotal2);
  29.     totalAmount = subTotal1 + subTotal2 + taxAmount;
  30.  
  31.  
  32. // Program's output results
  33.  
  34.     printf("Your total is: %.2f\n", totalAmount);
  35.  
  36.     printf("Enter Changing money\n");
  37.     int cm;
  38.     scanf("%d", &cm);
  39.     int b;
  40.     b = cm;
  41.  
  42.     float a;
  43.     a= totalAmount;
  44.  
  45.  
  46.     printf ("Here is your change %.2f\n", cm-a);
  47.  
  48.  
  49.     printf("Thank you for shopping with us!");
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement