Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello I'm having difficulty understanding this problem with my study guide question for my Intermediate Java class with ArrayList. I cannot figure out how to

Hello I'm having difficulty understanding this problem with my study guide question for my Intermediate Java class with ArrayList. I cannot figure out how to use the ArrayList to maintain the orders. Any help will be greatly appreciated.

Modify the program so that when an order is added using the application that an ArrayList of Orders is maintained in the main class. Note that the list object will be accessed from the static methods of the main class and would need to be static (though it should still be private). Each time the addOrder method is called the new order object should be added to this collection.

Add option 3 which will show all of the orders that have been created since the program started running.

Using a HashSet, add option 4 which will show the distinct customers that have been added to the system. Loop through each order and add the Customer object to a HashSet collection.

To allow this collection of Customers to not have duplicates, you will need to implement the hashcode() and equals(Object e) methods. After adding all of the customers to the HashSet, loop through the HashSet and show each customer. You may need to do a bit of research to figure this out. A customer is deemed to be the same if they have the same name. Note that Netbeans has a good tool to generate the HashCode and equals methods.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Contrast relational contexts in organizations

Answered: 1 week ago

Question

2. Describe ways in which organizational culture is communicated

Answered: 1 week ago

Question

1. Describe and compare approaches to managing an organization

Answered: 1 week ago