Search code examples
pseudocode

Homework trouble, pseudocode


I was sick and so I missed my past 2 classes, I was wondering if someone could help me figure out how to solve this problem and I could sort of study it and try to understand it,I need pseudocode for this problem, I feel like I'm falling a little behind:

The Vernon Hills Mail-Order Company often sends multiple packages per order. For each customer order, output enough mailing labels to use on each of the boxes that will be mailed. The mailing labels contain the customer’s complete name and address, along with a box number in the form Box 9 of 9. For example, an order that requires three boxes produces three labels: Box 1 of 3, Box 2 of 3, and Box 3 of 3. Design an application that reads records that contain a customer’s title (for example, Mrs.), first name, last name, street address, city, state, zip code, and number of boxes. The application must read the records until eof is encountered and produce enough mailing labels for each order.


Solution

  • Write down each separate step that you list on a line of its own, and draw arrows between them, to indicate that a step should be followed by the next one.

    That will process one "order". Since an order may consist of multiple boxes, look for where you can loop in this part. Draw a small arrow upwards to the right step where to restart for an individual box in an order.

    At the end of this diagram you have processed a single "order", so now look for where the main loop should restart and on what condition.

    With this done you have a flow chart; a purely visual aid, which you can translate into pseudocode (or, for that matter, directly into any programming language that has the right commands). So all that's left is to translate the graphic arrows into appropriate pseudo-code.