Question: JAVA question create a class People that will store a table of people's first names and ages (using a HashMap, the people's names as the

JAVA question

create a class People that will store a table of people's first names and ages (using a HashMap, the people's names as the key, and integer ages as the value). Read people and ages from the console (e.g. Bob 19) and add to the HashMap. For this example, assume ages are integers and names do not contain spaces. After a list of name, age pairs, a name will be entered without an age (e.g. Mary) and the user will terminate their input by typing ctrl-D, by pressing the control and 'D' keys (ctrl-Z on Windows). Treat the last name (Mary in this example) as a query. Print out the age of the person entered last, or print unknown if the person's name is unknown (i.e. it did not appear earlier in the list).

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!