Advertisement
BladeMechanics

kimfixed

Dec 13th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.99 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <conio.h>
  4.  
  5.  
  6. int main() {
  7.     int fchoice, schoice, quantity, stotal, total = 0, x;
  8.     do {
  9.         printf("Do you want to purchase an item?\n Yes\t(1)\n No\t(2)");
  10.         scanf("%d", &x);
  11.         switch (x)
  12.         {
  13.         case 1:
  14.         {
  15.             printf("Select your order:\n1.Plywood\n2.Nails\n3.Metal Sheet\n");
  16.             scanf("%d", &fchoice);
  17.             switch (fchoice)
  18.             {
  19.             case 1:
  20.                 printf("Thickness:\n1. 1 inch\tPhp. 300.00\n2. 3/4 inch\t Php. 250.00\n3.1/2 inch\t Php. 200.00\n4. 1/4 inch\t Php. 150.00\n");
  21.                 scanf("%d", &schoice);
  22.                 switch (schoice)
  23.                 {
  24.                 case 1:
  25.                     printf("Enter quantity to be purchased:\t");
  26.                     scanf("%d", &quantity);
  27.                     stotal = quantity * 300;
  28.                     break;
  29.                 case 2:
  30.                     printf("Enter quantity to be purchased:\t");
  31.                     scanf("%d", &quantity);
  32.                     stotal = quantity * 250;
  33.                     break;
  34.                 case 3:
  35.                     printf("Enter quantity to be purchased:\t");
  36.                     scanf("%d", &quantity);
  37.                     stotal = quantity * 200;
  38.                     break;
  39.                 case 4:
  40.                     printf("Enter quantity to be purchased:\t");
  41.                     scanf("%d", &quantity);
  42.                     stotal = quantity * 150;
  43.                     break;
  44.                 default:
  45.                     printf("Option not found!");
  46.                     break;
  47.                 }
  48.                 break;
  49.             case 2:
  50.                 printf("Per Kilo:\n1. 1.5 inch\tPhp. 60.00\n2. 2 inches\t Php. 70.00\n3. 2.5 inches\t Php. 80.00\n4. 3 inches\t Php. 90.00\n");
  51.                 scanf("%d", &schoice);
  52.                 switch (schoice)
  53.                 {
  54.                 case 1:
  55.                     printf("Enter quantity to be purchased:\t");
  56.                     scanf("%d", &quantity);
  57.                     stotal = quantity * 60;
  58.                     break;
  59.                 case 2:
  60.                     printf("Enter quantity to be purchased:\t");
  61.                     scanf("%d", &quantity);
  62.                     stotal = quantity * 70;
  63.                     break;
  64.                 case 3:
  65.                     printf("Enter quantity to be purchased:\t");
  66.                     scanf("%d", &quantity);
  67.                     stotal = quantity * 80;
  68.                     break;
  69.                 case 4:
  70.                     printf("Enter quantity to be purchased:\t");
  71.                     scanf("%d", &quantity);
  72.                     stotal = quantity * 90;
  73.                     break;
  74.                 default:
  75.                     printf("Option not found!");
  76.                     break;
  77.                 }
  78.                 break;
  79.             case 3:
  80.                 printf("Thickness:\n1. 4.18 mm\tPhp. 400.00\n2. 3.80 mm\t Php. 350.00\n3. 3.42 mm\t Php. 300.00\n 4. 3.04 mm\t Php. 250.00\n");
  81.                 scanf("%d", &schoice);
  82.                 switch (schoice)
  83.                 {
  84.                 case 1:
  85.                     printf("Enter quantity to be purchased:\t");
  86.                     scanf("%d", &quantity);
  87.                     stotal = quantity * 400;
  88.                     break;
  89.                 case 2:
  90.                     printf("Enter quantity to be purchased:\t");
  91.                     scanf("%d", &quantity);
  92.                     stotal = quantity * 350;
  93.                     break;
  94.                 case 3:
  95.                     printf("Enter quantity to be purchased:\t");
  96.                     scanf("%d", &quantity);
  97.                     stotal = quantity * 300;
  98.                     break;
  99.                 case 4:
  100.                     printf("Enter quantity to be purchased:\t");
  101.                     scanf("%d", &quantity);
  102.                     stotal = quantity * 250;
  103.                     break;
  104.                 default:
  105.                     printf("Option not found!");
  106.                     break;
  107.                 }
  108.                 break;
  109.             default:
  110.                 printf("Option not found!");
  111.                 break;
  112.             }
  113.             total += stotal;
  114.         }
  115.         break;
  116.         default:
  117.             printf("Thank you for browsing!");
  118.             break;
  119.         }
  120.     } while (x == 1);
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement