Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

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

Step: 3

blur-text-image

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

Be familiar with the integrative servicescape model.

Answered: 1 week ago

Question

Determine the roles of spatial layout and functionality.

Answered: 1 week ago