Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /*
- .
- .
- .
- */
- int main()
- {
- int redbushels;
- int redpecks;
- int redgallons;
- int goldenbushels;
- int goldenpecks;
- int goldengallons;
- int grannybushels
- int grannypecks;
- int grannygallons;
- int braeburnbushels;
- int braeburnpecks;
- int braeburngallons;
- int bushelprice;
- int peckprice;
- int gallonprice;
- int bushelapples;
- int peckapples;
- int gallonapples;
- int totalamount;
- int totalprice;
- cout << "Enter the number of red delicious bushels:";
- cin >> redbushels;
- cout << "Enter the number of red delicious pecks:";
- cin >> redpecks;
- cout << "Enter the number of red delicious gallons:";
- cin >> redgallons;
- #The first if statement checks to see if the value of redgallons is greater than or equal to 2
- #If so, then it will execute the code in the brackets
- if(redgallons >= 2)
- {
- /*This line will take redpecks value and add the value of (redgallons / 2) because
- 2 gallons is a peck*/
- redpecks = redpecks + redgallons / 2
- #This line checks if the value of redpecks is greater than or equal to 4
- if(redpecks >= 4)
- {
- /*This line will take the value of redbushels and add (redpecks / 4)
- because 4 pecks is a bushel*/
- redbushels = redbushels + redpecks / 4
- }
- }
- cout << "Enter the number of golden delicious bushels:";
- cin >> goldenbushels;
- cout << "Enter the number of golden delicious pecks:";
- cin >> goldenpecks;
- cout << "Enter the number of golden delicious gallons:";
- cin >> goldengallons;
- cout << "Enter the number of granny delicious bushels:";
- cin >> grannybushels;
- cout << "Enter the number of granny delicious pecks:";
- cin >> grannypecks;
- cout << "Enter the number of granny delicious gallons:";
- cin >> grannygallons;
- cout << "Enter the number of braeburn delicious bushels:";
- cin >> braeburnbushels;
- cout << "Enter the number of braeburn delicious pecks:";
- cin >> braeburnpecks;
- cout << "Enter the number of braeburn delicious gallons:";
- cin >> braeburngallons;
- // cout >> "
- bushelprice = redbushels * 20
- + goldenbushels * 20
- + grannybushels * 20
- + braeburnbushels * 20;
- peckprice = redpecks * 7
- + goldenpecks * 7
- + grannypecks * 7
- + braeburnpecks * 7;
- gallonprice = redgallons * 4
- + goldengallons * 4
- + grannygallons * 4
- + braeburngallons * 4;
- bushelapples = redbushels
- + goldenbushels
- + grannybushels
- + braeburnbushels;
- bushelapples = redbushels
- + goldenbushels
- + grannybushels
- + braeburnbushels;
- peckapples = redpecks
- + goldenpecks
- + grannypecks
- + braeburnpecks;
- gallonapples = redgallons
- + goldengallons
- + grannygallons
- + braeburngallons;
- totalamount = peckapples + bushelapples + gallonapples;
- totalprice = gallonprice + peckprice + bushelprice;
- //
- cout << "The total price of bushel is ";
- cout << bushelprice << endl;
- cout << "The total price of peck is ";
- cout << peckprice << endl;
- cout << "The total price of gallons is ";
- cout << gallonprice << endl;
- cout << " bushels ";
- cout << bushelapples << endl;
- cout << " pecks ";
- cout << peckapples << endl;
- cout << "gallons";
- cout << gallonapples << endl;
- cout << "The total amount is ";
- cout << totalamount << endl;
- cout << "The total price of all containers together is ";
- cout << totalprice;
- return 0;
- }
Add Comment
Please, Sign In to add comment