Computers and Technology, 30.11.2019 03:31 angelina0miles
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.
Answers: 3
Computers and Technology, 22.06.2019 15:00
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
Computers and Technology, 23.06.2019 19:00
Acompany is hiring professionals for web designing. the firm is small with few resources. they want employees who possess problem-solving skills and can independently carry out responsibilities. which kind of employee should they select?
Answers: 2
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
Computers and Technology, 23.06.2019 21:40
language consists of basic components, and they are called a. 3; mental images, concepts, and speech b. 2; language acquisition and linguistic relativity c. 3; heuristics, algorithms, and analogies d. 4; phonemes, morphemes, syntax, and semantics e. 2; words and grammar
Answers: 3
The vernon hills mail-order company often sends multiple packages per order. for each customer order...
Mathematics, 13.09.2019 02:30
Computers and Technology, 13.09.2019 02:30
History, 13.09.2019 02:30