Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 2 . 9 . 4 Ice Cream Combos You re at the ice cream store trying to decide what kind of ice cream and
Exercise Ice Cream Combos Youre at the ice cream store trying to decide what kind of ice cream and toppings you want. There are so many choices!
You decide to write a program to help you list out every possible choice.
Write a method
ArrayList getAllChoicesString flavors, String toppings
That takes an array of ice cream flavors and an array of toppings as parameters, and returns an ArrayList holding every possible combination of ice cream and toppings.
Each combination should be represented in the form
flavor with topping on top"
Where flavor is a provided flavor of ice cream, like chocolate and topping is a provided topping, like sprinkles
For example, the method call:
String flavors chocolate "vanilla";
String toppings sprinkles "fudge";
getAllChoicesflavors toppings;
Should return an ArrayList holding the following Strings:
chocolate with sprinkles on top", "chocolate with fudge on top", "vanilla with sprinkles on top", "vanilla with fudge on top"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started