Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialZach Drake
439 Pointsi try to write some dialogue need help
I try to write icecream shop dialogue but things not going well and wierd things happen. Codes working but arrays appears in wrong place
Console console = System.console();
console.printf("How do you take your icecream? %n");
console.printf("What kind of icecream do you have?");
String [] sweetFlavors = {"Caramel", "Cinnamon", "Watermelon", "Baked Beans"};
String [] savoryFlavors = {"Sea Salt", "Potato Chip", "Carrot", "Barbeque Sauce"};
for (String sweet : sweetFlavors){
for (String savory : savoryFlavors){
console.printf("%s and %s %n", sweet, savory);
String answer = console.readLine("What do you want?");
console.printf("here is your %s", answer);
} } } }
1 Answer
Sławomir Lasik
7,792 PointsThis code prints one the combination of two flawors and then asks for your one answer in each second loop iteration.
Think about the logic first ...