Either you didn't post the actual data you are getting from the API or you really need to clarify what it is you are trying to do and how. You could always just build your own LinkedList of entered candy orders-it's ugly, but it would work. As it stands, using forEach on that map will loop you through each key-value pair in that map, but trying to treat each value in that pair as a map in its own right is just asking for trouble. I'm assuming that, besides arrays, you're teacher isn't allowing you to use any standard Collection objects. To create an array variable, select the background of the pipeline canvas and then select the Variables tab to add an array type variable as shown below. I am sure there is an overly complex way of doing it with nested if/switch/while loops, but why teach us/force us to use the ugly inefficient way? output "MOSTSOLD " To use a ForEach activity in a pipeline, complete the following steps: You can use any array type variable or outputs from other activities as the input for your ForEach activity. Create lots of different, artbitrary, and predefined variables to be filled by the loop until they are overwritten. Output "There were/are no best selling, high priced candy!" What would be the most efficient way of doing this? startįinal String HEADING = "High Priced, Best Selling Candy" + "\n" + "\n" įinal String HSPS = candyName + " " + candyPrice + " " + candySold + " " įinal String MOSTSOLD = "Item that sold the most pounds is " And I do not want to define multiple instances of the same variable because it is finite to a certain amount.
Here is an example of a good design in operation: High-priced, Best-selling Candyįudge, 12.50, 4500 Jawbreakers, 6.50, 5500 Chocolate, 14.00, 790 Butterscotch, 9.50, 4500 Vanilla Creme, 13.75, 2200īut the problem I am having is that my teacher is not letting me use for loops, or arrays. and design online maps to visualize Floridas walkability using this devised.
High-priced items are those that sell for $10 per pound or more. Best-selling items are defined in Exercise 2a. A program that accepts candy data continuously until a sentinel value is entered and displays a list of high- priced, best-selling items. Best-selling items are those that sell more than 2000 pounds per month.ī. A program that accepts a candy name (for example, “chocolate-covered blueberries”), price per pound, and number of pounds sold in the average month, and displays the item’s data only if it is a best-selling item.