Question: package week_4; import java.util.ArrayList; /** * ArrayList practice. * Remove Oatmeal from the ArrayList. * Add the name of your favorite breakfast food to the

package week_4; import java.util.ArrayList; /**  * ArrayList practice.   * Remove "Oatmeal" from the ArrayList.  * Add the name of your favorite breakfast food to the ArrayList.  * Add "Cornflakes" to the ArrayList.  * Display all of the items in the ArrayList.  * Print a message if the ArrayList contains Special K. Print a different message if it does not contain "Special K".  * (optional) non-programming question: what does Captain Crunch have to do with computer hacking?   */ public class Question_1_Cereals_ArrayList { public static void main(String[] args) { new Question_1_Cereals_ArrayList().cereals(); } ArrayList cereals = new ArrayList(); public void cereals() { // Don't modify these three lines cereals.add("Special K"); cereals.add("Captain Crunch"); cereals.add("Oatmeal"); // TODO Remove "Oatmeal" from the ArrayList.   // TODO Add the name of your favorite breakfast cereal (or favorite breakfast food) to the ArrayList.   // TODO Add Cornflakes to the ArrayList.   // TODO Print all of the items in the ArrayList, one per line   // TODO Print the exact message "Special K is in the ArrayList" if the ArrayList contains Special K.   // TODO Print a different message if it does not contain "Special K".   // TODO (optional) non-programming question: what does Captain Crunch have to do with computer hacking?   } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!