Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do not use title=in.nextLine(); Please read the lower half of the assignment. Thank you The Vernon Hills Mail-Order Company often sends multiple packages per

Please do not use title=in.nextLine();

Please read the lower half of the assignment. Thank you

The Vernon Hills Mail-Order Company often sends multiple packages per order. For each customer order, print enough mailing labels to use on each of the separate boxes that will be mailed. The mailing labels contain the customers 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. Produce enough mailing labels for each order. Back then, we developed pseudocode that accomplished the logic and continued to process label requests until EOF was reached on the input file. This time, we will prompt the user to tell us when he or she is done and no further labels are needed. Specifically, our application will: Continuously accept a customers title, first name, last name, street address, city, state, zip code, and number of boxes in the order and produce the labels until an appropriate sentinel value is entered. After producing the first set of labels, your application will ask the user if s/he wishes to produce another set of labels. If the user response is Y or y the user is prompted for the input for the new set of labels. A user response that is anything other than Y or y means no further labels are needed and your program should end. The following pseudocode conveys this logic: start

Declarations

string title

string firstName

string lastName

string streetAddress

string city

string state

string zip

num numBoxes

num count

string enterAnother enterAnother = Y

while enterAnother is Y or y

input title, firstName, lastName, streetAddress, city, state, zip, numBoxes

count = 1

while count <= numBoxes

output title, firstName, lastName

output streetAddress

output city, state, zip

output Box , count, of , numBoxes

count = count + 1

endwhile

input enterAnother

endwhile

stop

From Java Chapter 2: Logical operators (and-or logic) From Java Chapter 4: equals() and compareTo() methods (pp. 52-54) From Java Chapter 5: Loop controlled by a sentinel value input by the user (while statement) Loop controlled by a counter (while statement or for statement, your choice) Nested loops Tips for converting this logic to Java: 1. You will use a dialog box to get each input from the user (the 7 name/address elements, the number of boxes, and the Y or N response after producing a set of labels). You will call the JOptionPane.showInputDialog() method to accomplish each dialog box. 2. All of the input you are soliciting from the user is String, except for numBoxes. This means that you dont need to use a method to convert any input other than numBoxes to numeric. You will use the Integer.parseInt method to convert the numBoxes String input to an integer. (Note, it is okay to leave zip as String because you are not doing math or numeric compares with it.) 3. The EOF logic involves an indefinite loop controlled by a sentinel value input by the user: o Design your application so that after you produce a set of labels for the user, you then prompt the user: Do you want to produce more labels? Y or N. o You will use a while statement for this EOF logic, continuing the loop until you receive something other than Y or y from the user. o You will need to define a variable to hold the Y-or-N input from the user. Remember to properly initialize this variable so that the first set of label info from the user is processed correctly. (Note, this logic is included in the pseudocode be sure to use the good work we did in developing that pseudocode!) o When comparing String values, remember to use a String method! 4. The label-producing loop logic is a counter-controlled loop. I suggest you first code this inner loop using a while statement, as that maps well to the pseudocode we have. Once you have your program working, then I encourage you to try using the Java for statement and Java increment operator (++) to accomplish the same logic. 5. The rhythm of your interface with the user is as follows. Screen prints are provided on the next page to help you visualize the user interface: o Use our method from class JOptionPane to prompt the user for several inputs, one at a time: title, firstName, lastName, streetAddress, city, state, zip, numBoxes o Use println() method to produce the label output to the user. o Use our method from class JOptionPane to ask if the user would like to produce more labels. If Y or y, send the input prompts again (title, firstName, lastName, etc.). Otherwise, end the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

a neglect of quality in relationship to international competitors;

Answered: 1 week ago

Question

Prepare a short profile of Henry words worth Longfellow?

Answered: 1 week ago

Question

What is RAM as far as telecommunication is concerned?

Answered: 1 week ago

Question

Question 1: What is reproductive system? Question 2: What is Semen?

Answered: 1 week ago