Java Bootcamp – Workbooks and Challenges
)}

Workbook 6.3

From Java Bootcamp Resources -> Module 1 -> 6. Arrays, open Workbook 6.3.

Java Grocer

In this workbook, you found work at the Java Grocer. Your job is to help customers find what they're looking for.

Task 1


The store has six aisles:

apples -- bananas -- candy -- chocolate -- coffee -- tea

Create an array that stores each aisle. Then, print the contents of the array using a for loop.

>>: apples
>>: bananas
>>: candy
>>: chocolate
>>: coffee
>>: tea

Once that works, keep the for loop but remove the println statement.

Task 2


A customer came in and they're wondering where the coffee is.

Do you sell coffee?

Use the for loop from task 1 to search through the array. If the element says: coffee, break the loop and print:

\nWe have that in aisle: <index>

Good Luck!

Feedback Summary
4.8
39 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.