Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Vernon Hills Mail-Order Company often sends multiple packages per order. For

ID: 3627778 • Letter: T

Question

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. Produce enough mailing labels for each order.

Pseudocode and Flowchart please. I am stumped.

Explanation / Answer

Assuming the data file contains one line for each record, this is actually pretty straight forward.

START PSEUDOCODE

##FUNCTIONS

function PrintLabel(title, name, surname, address, city, state, zip, box, boxes):

print title, name, surname

print address

print city, ",", state, zip

print "Box",box,"of",boxes

end function

##MAIN PROGRAM

datafile = [File path to datafile]

Readline datafile to title, name, surname, address, city, state, zip, and boxes

While not readline.fail:

box =1

While box <= boxes:

PrintLabel(title, name, surname, address, city, state, zip, box, boxes)

box = box + 1

End While

Readline datafile to title, name, surname, address, city, state, zip, and boxes

End While

END PSEUDOCODE

I've never been good at flowcharting, but it would look something like this:

START

1. Read Datafile

2. Did readline succeed?

     NO, Goto END

     YES, Goto 3

3. Box = 1

4. Is Box <= Boxes?

     Yes, Goto 2

     NO, Goto 5

5. Print Label

6. Box = Box + 1

7. Goto 1

END

I can't draw it using the custom diagrams, but I hope you can draw it yourself from the written description of that I drew.

This wouldn't be that bad using C++, which is probably what you would use it for.

When reading and printing to file, you will need to use fstream.

Check out this site for help with this in C++.

http://www.cplusplus.com/doc/tutorial/files/

Good luck!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote