Question: Write main method Image that you have a map that records the information about a group of people and who they have dated. The map

Write main method

Write main method Image that you have a map that records the

information about a group of people and who they have dated. The

Image that you have a map that records the information about a group of people and who they have dated. The map is defined as follows: Map> dateList; The map is a set of names, and then each name is mapped to a list of people that they have dated in the order they dated them. So an example record might contain the following: Michael => [Ashley, Samantha, Joshua, Brittany, Amanda, Amanda] Amanda => [Michael, Daniel, Michael] Samantha=> [Michael] The dates are listed in reverse order. The list for Michael indicates that he most recently dated Ashley and before that Samantha and before that Joshua, and so on. Notice that he has dated Amanda twice. The list for Amanda indicates that she most recently dated Michael and before that Daniel and before that Michael. All names are stored as string values. Write a method called recordDate (Map, String, String) that records information about a date between two people. The method takes three parameters: the map, the name of the first person, and the name of the second person. It should record the date for each person into the map. Given the entries above, if we make this call: recordDate(datelist, "Michael", "Amanda"); The method would record the new date at the front of each list: Michael => [Amanda, Ashley, Samantha, Joshua, Brittany, Amanda, Amanda] Amanda => [Michael, Michael, Daniel, Michael] If a new person is added to the group, then create a new List for them to start. Notes: o Make sure to add people to both lists. If you need to make a new list, create a new LinkedList. o Remember to add new dates to the front of the list. Map> dateList = new TreeMap(); recordDate (dateList, "Michael", "Amanda"); recordDate (dateList, "George", "Marie Ann"); recordDate (dateList, "Daniel", "Amanda"); recordDate (dateList, "Michael", "Amanda"); recordDate (dateList, "Michael", "Joshua"); recordDate (dateList, "Ashley", "Jose"); recordDate (dateList, "Michael", "Samantha"); recordDate (dateList, "Michael", "Ashley"); recordDate (dateList, "Jose", "Susan"); recordDate (dateList, "Susan", "George"); recordDate (dateList, "Billy", "Marie Ann"); recordDate (dateList, "Marie Ann", "Billy"); recordDate (dateList, "Michael", "Marie Ann"); recordDate (dateList, "Amanda", "Daniel"); recordDate (dateList, "Amanda", "Marie Ann"); recordDate (dateList, "Clark", "Lana"); recordDate (dateList, "Lois", "Clark")

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!