Question: The Language is JAVA. Thank you! Create a user-defined class (eg: Member.java) that contains - variables: name, age - constructor to save name & age
The Language is JAVA. Thank you!

Create a user-defined class (eg: Member.java) that contains - variables: name, age - constructor to save name \& age - methods: getName(), getAge() - Refer to slide \#17 (Week4-1) Create a test program (eg: CP6.java) Declare a HashMap that contains the user-defined class. - Ask for the user to select one of the following menu. 1) add 2) remove 3)quit if the user's selection is 1), - ask for id, name, age - add to the hashmap using the constructor. Key must be the id - generate success-message - print the size of the hashmap and all the current data in the hashmap. - (refer to slide \#18 \& \#15 (Week 4-1) If selection is 2 ) - ask for an id to be removed - if the id is not in the hashMap, generate an error messge. - use .containsKey(key) to check if the key is in the hashmap - If the id is in the hashMap, remove it and generate success-message - print the size of the hashmap and all the current data in the hashmap. - (refer to slide \#14, \#15 (Week 4-1) If selection is 3 )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
