Question
Assignment 4: Shopping list (JAVA) Objective: Read in the names of several grocery items from the keyboard and create a shopping list using the Java
Assignment 4: Shopping list (JAVA)
Objective: Read in the names of several grocery items from the keyboard and create a shopping list using the Java ArrayList abstract data type.
1) Create a new empty ArrayList
2) Ask the user for 5 items to add to a shopping list and add them to the ArrayList (get from the user via the keyboard).
3) Prompt the user for an item to search for on the list. Output a message to the user letting them know whether the item exists in the shopping list. Use a method that is part of the ArrayList class to do the search.
4) Prompt the user for an item to delete from the shopping list and remove it. (be sure to handle the case where they dont want to delete anything). Use a method that is part of the ArrayList class to do the delete.
5) Prompt the user for an item to insert into the list. Ask them what they want to insert and where they want to insert it (after which item). Use a method that is part of the ArrayList class to do the insertion.
6) Output the final list to the user.
MY CODE
package assignment4;
import java.util.ArrayList;
import javax.swing.JOptionPane;
public class arrayexample {
public static void main(String[] args) { ArrayList
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started