Home >
Tutorials >
Write Code Segments that Require ArrayLists and iteration.
Write Code Segments that Require ArrayLists and iteration.
Need Help? Check out these resources!
Your Turn
- Write program code to complete the provided tasks.
- Run the code in the Java Playground to see if your code generates the desired result.
- Make necessary changes until you have satisfied the tasks.
Practice 1: Daily High Temperatures
- Given the
ArrayList temps that contains daily high temperatures, write program code to print the all temperatures above 100.
- Try the code in the Java Playground to verify your prediction.
Practice 2: Personalize Messages
- Given the
ArrayList guests, print a personalized welcome message for each attendee of a party (e.g., "Welcome, Maria!").
- Try the code in the Java Playground to verify your prediction.
Practice 3: Longest String
- Given the
ArrayList words, write code to find and print the word with the longest string.
- Try the code in the Java Playground to verify your prediction.
Practice 4: Make File Name
- Given the
ArrayList filenames, write code to add .jpg to the end of each file name that doesn't already end this way.
- Try the code in the Java Playground to verify your prediction.
Practice 5: Average Mileage
- Given the
ArrayList mileage, write code to calculate and print the average mileage.
- Try the code in the Java Playground to verify your prediction.