Join Peggy Fisher for an in-depth discussion in this video Challenge: Groceries, part of Learning Java.
- This challenge combines our knowledge of ArrayLists…with the concept of a linear search.…We start by creating a string ArrayList.…Then, you want to add five grocery items to the list,…using the dot add method.…Now, ask the user to enter a random grocery item,…and search the list, looking for a match.…Use a linear search, since the original array is very small.…Try entering a value that is found, and then run it again,…looking for one that is not found.…If it is not found, add it to the end of the list.…
When the user is done adding items,…print out the final version of the grocery list.…I have estimated that this challenge should…take about 20 minutes.…Good luck!…
- Downloading and exploring NetBeans
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Creating classes
- Sorting and searching arrays
- Manipulating files
- Handling errors
- Building GUIs
Skill Level Beginner
1. Getting Started
2. Java Basics
3. Flow of Control
4. Classes and Objects
5. Beyond the Basics
6. File Manipulation
7. Graphical User Interface Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.