Question: Create an application class named GroceryCart.java: 1. Ask the user to enter how many items are they planning to buy today. Save this number as

Create an application class named GroceryCart.java: 1. Ask the user to enter how many items are they planning to buy today. Save this number as an int variable numItems 2. Create two arrays: String [] names and Double [] prices of size numItems 3. Now, using a loop, ask the user to enter the name and price of i-th item in the cart and store them at appropriate locations in the arrays 4. Once the arrays have been create, create two objects of the generic class AnyArray: a. AnyArray nameList = new AnyArray(names); b. AnyArray priceList = new AnyArray(prices); 5. Print the information about nameList and priceList using the toString methods 6. Now, ask the user to enter the name of the item they want to search for and store it in a string variable search. Pass this search item to the method findLocation using the nameList. 7. If the item is found in the list, print its price using the getIth( ) method with priceList. If the item is not found, print Item not found

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!