What are the steps to verify that an item number exists in an array? Provide an example.
What will be an ideal response?
To verifying that an item number exists in an array:Set a flag variable named foundIt to "N". A flag is a variable that is set to indicate whether some event has occurred. In this example, N indicates that the item number has not yet been found in the list. A subscript, sub, is set to 0. This subscript will be used to access each element in the array.A loop executes, varying sub from 0 through one less than the size of the array. Within the loop, the customer's ordered item number is compared to each item number in the array. If the customer ordered item matches any item in the array, the flag variable is assigned "Y". After all six valid item numbers have been compared to the ordered item, if the customer item matches none of them, then the flag variable foundIt will still hold the value "N".If the flag variable's value is "Y" after the entire list has been searched, it means that the item is valid and an appropriate message is displayed, but if the flag has not been assigned "Y", the item was not found in the array of valid items. In this case, an error message is output and 1 is added to a count of bad item numbers.
You might also like to view...
Which of the following statements regarding abstract methods is false?
a. An abstract class can have instances created using the constructor of the abstract class. b. An abstract class can be extended. c. A subclass of a non-abstract superclass can be abstract. d. A subclass can override a concrete method in a superclass to declare it abstract. e. An abstract class can be used as a data type.
The ________ is used to select all of the fields in the current layout
A) Manage Attachments button B) Layout Selector C) Stacked layout D) Mini toolbar
If someone is ________, they are using an email message or a website to trick you into revealing your personal or financial information
A) trolling B) surfing C) phishing D) spamming
Which of the following is not used when creating a calculated field in a PivotTable?
What will be an ideal response?