Guest User

Untitled

a guest
Dec 12th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.48 KB | None | 0 0
  1.     #include <iostream>
  2.     using namespace std;
  3.     /*
  4.     .
  5.     .
  6.     .
  7.     */
  8.     int main()
  9.     {
  10.             int redbushels;
  11.             int redpecks;
  12.             int redgallons;
  13.             int goldenbushels;
  14.             int goldenpecks;
  15.             int goldengallons;
  16.             int grannybushels
  17.     int grannypecks;
  18.             int grannygallons;
  19.             int braeburnbushels;
  20.             int braeburnpecks;
  21.             int braeburngallons;
  22.             int bushelprice;
  23.             int peckprice;
  24.             int gallonprice;
  25.             int bushelapples;
  26.             int peckapples;
  27.             int gallonapples;
  28.             int totalamount;
  29.             int totalprice;
  30.      
  31.             cout << "Enter the number of red delicious bushels:";
  32.             cin >> redbushels;
  33.             cout << "Enter the number of red delicious pecks:";
  34.             cin >> redpecks;
  35.             cout << "Enter the number of red delicious gallons:";
  36.             cin >> redgallons;
  37.  
  38.         #The first if statement checks to see if the value of redgallons is greater than or equal to 2
  39.         #If so, then it will execute the code in the brackets
  40.         if(redgallons >= 2)
  41.         {
  42.         /*This line will take redpecks value and add the value of (redgallons / 2) because
  43.         2 gallons is a peck*/
  44.         redpecks = redpecks + redgallons / 2
  45.         #This line checks if the value of redpecks is greater than or equal to 4
  46.         if(redpecks >= 4)
  47.         {
  48.             /*This line will take the value of redbushels and add (redpecks / 4)
  49.             because 4 pecks is a bushel*/
  50.             redbushels = redbushels + redpecks / 4
  51.         }
  52.         }
  53.        
  54.  
  55.             cout << "Enter the number of golden delicious bushels:";
  56.             cin >> goldenbushels;    
  57.             cout << "Enter the number of golden delicious pecks:";
  58.             cin >> goldenpecks;
  59.             cout << "Enter the number of golden delicious gallons:";
  60.             cin >> goldengallons;
  61.  
  62.             cout << "Enter the number of granny delicious bushels:";
  63.             cin >> grannybushels;
  64.             cout << "Enter the number of granny delicious pecks:";
  65.             cin >> grannypecks;
  66.             cout << "Enter the number of granny delicious gallons:";
  67.             cin >> grannygallons;
  68.             cout << "Enter the number of braeburn delicious bushels:";
  69.             cin >> braeburnbushels;
  70.             cout << "Enter the number of braeburn delicious pecks:";
  71.             cin >> braeburnpecks;
  72.             cout << "Enter the number of braeburn delicious gallons:";
  73.             cin >> braeburngallons;
  74.      
  75.             // cout >> "
  76.             bushelprice = redbushels * 20
  77.                  + goldenbushels * 20
  78.                  + grannybushels * 20
  79.                  + braeburnbushels * 20;
  80.      
  81.             peckprice = redpecks * 7
  82.                  + goldenpecks * 7
  83.                  + grannypecks * 7
  84.                  + braeburnpecks * 7;
  85.      
  86.             gallonprice = redgallons * 4
  87.                  + goldengallons * 4
  88.                  + grannygallons * 4
  89.                  + braeburngallons * 4;
  90.      
  91.      
  92.             bushelapples = redbushels
  93.                  + goldenbushels
  94.                  + grannybushels
  95.                  + braeburnbushels;
  96.      
  97.             bushelapples = redbushels
  98.                  + goldenbushels
  99.                  + grannybushels
  100.                  + braeburnbushels;
  101.      
  102.             peckapples = redpecks
  103.                  + goldenpecks
  104.                  + grannypecks
  105.                  + braeburnpecks;
  106.             gallonapples = redgallons
  107.                  + goldengallons
  108.                  + grannygallons
  109.                  + braeburngallons;
  110.      
  111.             totalamount = peckapples + bushelapples + gallonapples;
  112.      
  113.            totalprice = gallonprice + peckprice + bushelprice;
  114.      //
  115.             cout << "The total price of bushel is ";
  116.             cout << bushelprice << endl;
  117.             cout << "The total price of peck is ";
  118.             cout << peckprice << endl;
  119.             cout << "The total price of gallons is ";
  120.             cout << gallonprice << endl;
  121.             cout << " bushels ";
  122.             cout << bushelapples << endl;
  123.             cout << " pecks ";
  124.             cout << peckapples << endl;
  125.             cout << "gallons";
  126.             cout << gallonapples << endl;
  127.             cout << "The total amount is ";
  128.             cout << totalamount << endl;
  129.             cout << "The total price of all containers together is ";
  130.             cout << totalprice;
  131.             return 0;
  132.     }
Add Comment
Please, Sign In to add comment