none
Homework RRS feed

  • Question

  • Create a program that allows a shipping clerk at a company to input an item’s name, the total quantity of that item that is currently in inventory, and the number of that item that will fit in a box for shipping. The program should display back the item’s name, the number of full boxes that can be shipped based on the quantity in inventory, and the number of items that will be left over. PLease help! So far I have the following: 

    {
    string wrench;
    double item = 0.0;
    double total_quantity = 0.0;
    double amount_perbox = 0.0;

    cout << "Enter Item: ";
    cin >> item;
    cout << "Enter item total quantity: ";
    cin >> total_quantity;

    //cout << “Enter amount per box: “;
    //cin >> “amount_perbox;

    amount_perbox = 30;

    cout << "amount_perbox: " << amount_perbox << endl;
    system("pause");
    return 0;

    }

    Sunday, February 1, 2015 6:05 PM

Answers

  • Create a program that allows a shipping clerk at a company to input an item’s name, the total quantity of that item that is currently in inventory, and the number of that item that will fit in a box for shipping. The program should display back the item’s name, the number of full boxes that can be shipped based on the quantity in inventory, and the number of items that will be left over.

    {
    string wrench;
    double item = 0.0;
    double total_quantity = 0.0;
    double amount_perbox = 0.0;

    cout << "Enter Item: ";
    cin >> item;
    cout << "Enter item total quantity: ";
    cin >> total_quantity;

    //cout << “Enter amount per box: “;
    //cin >> “amount_perbox;

    amount_perbox = 30;

    cout << "amount_perbox: " << amount_perbox << endl;

    Some things to consider:

    (1) The problem description asks for the product *name*.
         Is your code accepting a *name*?
        
    (2) The problem description asks for the quantity of a product in the inventory.
        Is it logical that there might be *part* of a product in stock?
        If not, why use a value that has decimal fractions?
        Wouldn't whole numbers (integers) make more sense?
        
    (3) Likewise for the number of items per box - if it's not likely that you can put part
        of a product in a box, shouldn't you be using whole numbers only?
        
    (4) Since the problem specification requires inputting the number of that item that
        will fit in a box, why have you commented out that part? Why hard-code a value,
        when it should be obvious that the number will vary for each product?
        
    (5) Where's the calculations required? If the on-hand value for a product is 120, and the
        number of that product that can fit in a box is 10, how many boxes will be needed?
        
        If the on-hand value for a product is 124, and the number of that product that can fit
        in a box is 10, how many boxes will be needed? How many will be left in stock after
        filling those boxes?
        
    (6) The problem description asks for the output to show three things: name, max full boxes,
        remaining inventory. Where are you doing that? Why are you doing a cout of an input
        value that isn't required to be displayed?
        
     - Wayne
     

    • Marked as answer by Shu 2017 Monday, February 16, 2015 11:41 AM
    Sunday, February 1, 2015 7:46 PM

All replies

  • I added the extra lines with the "//" just in case I was going to need to use it.
    Sunday, February 1, 2015 6:09 PM
  • Create a program that allows a shipping clerk at a company to input an item’s name, the total quantity of that item that is currently in inventory, and the number of that item that will fit in a box for shipping. The program should display back the item’s name, the number of full boxes that can be shipped based on the quantity in inventory, and the number of items that will be left over. PLease help! So far I have the following: 

    {
    string wrench;
    double item = 0.0;
    double total_quantity = 0.0;
    double amount_perbox = 0.0;

    cout << "Enter Item: ";
    cin >> item;
    cout << "Enter item total quantity: ";
    cin >> total_quantity;

    //cout << “Enter amount per box: “;
    //cin >> “amount_perbox;

    amount_perbox = 30;

    cout << "amount_perbox: " << amount_perbox << endl;
    system("pause");
    return 0;

    }


    I guess the best is you do your homework alone. If you have specific questions that may be worth discussing, and help.

    You should keep in mind a forum is not the place to do your homework.


    Best regards

    Bordon

    Note: Posted code pieces may not have a good programming style and may not perfect. It is also possible that they do not work in all situations. Code pieces are only indended to explain something particualar.



    • Edited by Bordon Sunday, February 1, 2015 6:37 PM
    Sunday, February 1, 2015 6:34 PM
  • Create a program that allows a shipping clerk at a company to input an item’s name, the total quantity of that item that is currently in inventory, and the number of that item that will fit in a box for shipping. The program should display back the item’s name, the number of full boxes that can be shipped based on the quantity in inventory, and the number of items that will be left over.

    {
    string wrench;
    double item = 0.0;
    double total_quantity = 0.0;
    double amount_perbox = 0.0;

    cout << "Enter Item: ";
    cin >> item;
    cout << "Enter item total quantity: ";
    cin >> total_quantity;

    //cout << “Enter amount per box: “;
    //cin >> “amount_perbox;

    amount_perbox = 30;

    cout << "amount_perbox: " << amount_perbox << endl;

    Some things to consider:

    (1) The problem description asks for the product *name*.
         Is your code accepting a *name*?
        
    (2) The problem description asks for the quantity of a product in the inventory.
        Is it logical that there might be *part* of a product in stock?
        If not, why use a value that has decimal fractions?
        Wouldn't whole numbers (integers) make more sense?
        
    (3) Likewise for the number of items per box - if it's not likely that you can put part
        of a product in a box, shouldn't you be using whole numbers only?
        
    (4) Since the problem specification requires inputting the number of that item that
        will fit in a box, why have you commented out that part? Why hard-code a value,
        when it should be obvious that the number will vary for each product?
        
    (5) Where's the calculations required? If the on-hand value for a product is 120, and the
        number of that product that can fit in a box is 10, how many boxes will be needed?
        
        If the on-hand value for a product is 124, and the number of that product that can fit
        in a box is 10, how many boxes will be needed? How many will be left in stock after
        filling those boxes?
        
    (6) The problem description asks for the output to show three things: name, max full boxes,
        remaining inventory. Where are you doing that? Why are you doing a cout of an input
        value that isn't required to be displayed?
        
     - Wayne
     

    • Marked as answer by Shu 2017 Monday, February 16, 2015 11:41 AM
    Sunday, February 1, 2015 7:46 PM