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, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
@josethesolis i need can anyone text me and follow me
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
Develop the program incrementally: a) start by reading and displaying each line of the input file to make sure you are reading the data set correctly. b) use the split string method to extract information from each line into a list. print the list to prove that this step is working correctly. d) convert the exam scores to type int and calculate the student’s average. display those items to prove this step is working correctly. e) create a tuple containing the six items for each student (name, exam scores, exam mean). display the tuples to prove this step is working correctly. (optionally, you may want to have the exam scores in a list so your tuple is (name, scores_list, f) append each tuple to a list. display the list to prove this step is working correctly. g) use the sort list method to re-order the tuples in the list. display the list to prove this step is working correctly. h) use a for statement to display the contents of the list as a table (with appropriate formatting). i) use a for statement to calculate the average of all scores on exam #1, then display the results. note that you could have calculated this average within the first loop, but we are explicitly requiring you to do this calculation by looping though your list of tuples. j) add the logic to calculate the average of all scores on exam #2, then display the results.
Answers: 2
You know the right answer?
The vernon hills mail-order company often sends multiple packages per order. for each customer order...
Questions
question
Mathematics, 08.10.2019 01:30
question
History, 08.10.2019 01:30
question
Computers and Technology, 08.10.2019 01:30
Questions on the website: 13722367