subject

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 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". 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 customer’s 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 don’t 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 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, otherwise, end the program.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:40
Respecting individual differencespre-test active2time remaining48: 47nina is exploring her gender identity and sexual orientationwhich best describes how the role of the media might influence nina during this time in her life? the media would her decide because television shows are always unbiased about gender issues and do notstereotypethe media could make things difficult for her because television sometimes portrays rigid ideas about gender roles.all forms of media will her decide because the media always portrays rigid ideas about gender roles.all forms of media will make things easy for her because the media always portrays open and fair ideas about gender roles.
Answers: 1
question
Computers and Technology, 22.06.2019 07:30
What type of computer network ensures high security ?
Answers: 1
question
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
In cell h5 enter a formula that will calculate the percentage of attendees that went to the altamonte springs job fair in 2018.
Answers: 1
You know the right answer?
The vernon hills mail-order company often sends multiple packages per order. for each customer order...
Questions
question
English, 31.01.2020 10:45
question
Chemistry, 31.01.2020 10:45
question
Mathematics, 31.01.2020 10:45
Questions on the website: 13722361