Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with designig a java project with the following requirements: Use the bluej project called DateDotCom to complete the classes described in this handout.

Need help with designig a java project with the following requirements:

Use the bluej project called DateDotCom to complete the classes described in this handout.

1. The Member class represents a specific member of a match making service. It stores the members id: id, the members age: age, the members gender: gender and the members hobbies: hobbies. Write the Member class according to the following specifications:

a. Add the four (4) fields that make up the Member class. (hobbies is an ArrayList of String)

b. Add a constructor that takes three (3) parameters: The first parameter is a String used to initialize the id of the member, the second parameter is an int used to initialize the age of the member and the third parameter is a String used to initialize the gender of the member. The field hobbies is initialized to an empty ArrayList of String.

c. Add a method called addHobby that takes one (1) parameter, a String hobby, which is the new hobby to be added to the field hobbies.

d. Add a method called memberEquals that takes one (1) parameter, a String id. If the id and the id of this are the same return true, otherwise return false. Note: the case of the letters in the Strings should not make a difference.

e. Add a method called memberToString. This method returns a String that is formatted exactly like example 1.

f. The method getHobbies is provided for you. This method returns the field hobbies as a String that can be used to display a members hobbies.

1. The MatchMaker class represents a match making companys client list. This class stores as many Member objects as the user wishes to enter. Create the MatchMaker class according to the following specifications:

a. Write a static method called addHobbiesToMember that adds hobbies to a member. This method will be invoked by the main method. This method takes one (1) parameter, a Member object named member, which is used to add hobbies to.

i. In order to create this method declare the following local variables: 1) a String input, 2) a String output, 3) a String hobby, 4) a boolean finished.

ii. Allow the user to enter new hobbies for the member until the user is finished.

1. Use a dialog box to ask the user for a new hobby for the member. Use the String output as the message for the showInputDialog method. output should be a concatenation of the members current hobby list and the MORE_HOBBIES message.

2. If the user enters either n or no (upper or lower case is ok), then they are finished entering hobbies and you need to exit the loop, otherwise add the hobby to the members hobby list and show the HOBBY_ADDED message.

b. Finish the main method following the steps below (like the main method used in previous labs and the previous homework). This method will allow a user to enter one or more Member objects into the system until the user says they are done entering members. Make sure to use the method testForCancel (defined in 2.d.) any time the user is asked for input. Do not use any variables in this method, except those already given to you.

1. Instantiate the members arraylist.

2. Add Member objects to members. Use the arrays ID, AGE and GENDER to get the corresponding parameters for the Member object. Make sure your code can adjust to the size of the arrays (all three arrays will always be equal in length). Each new member created in this loop also needs two hobbies. The hobbies are to be randomly picked from the HOBBIES array. (Do not worry if the same hobby is picked twice for the same member).

3. Create a loop that lasts until the user signals they are done adjusting the members list.

a. Use a dialog box to ask the user if they would like to show the members. If the user enters either y or yes (in any combination of lower or upper case letters) then show the user the members (use the showMembers method defined in 2.c.) and continue, otherwise just continue.

b. Use a dialog box to ask the user for the id of the member and then use a dialog box to ask the user for the age of the member and finally, use a dialog box to ask the user for the gender of the member. When getting the users input for the members gender, make sure you continue to ask until the user enters either an M or an F; upper or lower case is ok.

c. Reset correct to false for next use.

d. Create a Member object using the users input from the line above (2.b.3.b.)

Check to see if the id of the member object matches an id of a member in the members arraylist using the memberEquals method.

1. If the id from (2.b.3.b.) is a members id in members

i. Remember that the member was found.

ii. Allow the user to enter a new hobbies for the member until the user is finished by calling the method addHobbiesToMember.

f. If the id entered from (2.b.3.b.) was not found in members, then this is a new member.

1. Allow the user to enter new hobbies for the new member until the user is finished by calling the method addHobbiesToMember.

2. Add the new member to members and show a message that the new member has been added.

g. Use a dialog box to ask the user if they would like to enter another member. If the user enters either y or yes (in any combination of lower or upper case letters) then then reset the found boolean variable and let the user continue entering members, otherwise indicate you are done and show the user the members (use the showMembers method defined below).

4. Exit the program.

a. Write a static method called showMembers that will be invoked by the main method to print Member objects entered by the user. This method takes one parameter ArrayList<Member> named members. The output must be formatted exactly like example 2.

b. Write a static method called testForCancel that has one parameter a String test. If test is null then exit the program, otherwise do nothing.

Example 1:

ID : seriously38

Gender : F

Age : 38

Hobbies :

Tennis, Cooking.

Example 2:

Match Maker Database

---------------------------------

ID : seriously38

Gender : F

Age : 38

Hobbies :

Tennis, Cooking.

---------------------------------

ID : babyblueeyes

Gender : F

Age : 22

Hobbies :

Soccer, Reading.

---------------------------------

ID : holyroller

Gender : M

Age : 32

Hobbies :

Hunting, Fishing.

---------------------------------

ID : M3hImL33t

Gender : M

Age : 18

Hobbies :

Bowling, TV.

---------------------------------

ID : naturegrl

Gender : F

Age : 27

Hobbies :

Movies, Volleyball.

The DataDotCom is a title so that we know that it is supposed to represent like an online dating site. So the project is to create a java project to simulate an online dating site under those circumstances.

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

Students also viewed these Databases questions

Question

How may mindfulness enhance sport performance?

Answered: 1 week ago