Question: java class how to write this main function? Match class Write a Match class that with main()) that performs the following functions . Create an

 java class how to write this main function? Match class Write

java class how to write this main function?

Match class Write a Match class that with main()) that performs the following functions . Create an array of students max = 100) * Read all student information (tab delimited) from a text fle o Nam (String) o Gender (char) o Birthdate (String: Month-Day-Year, hyphen '' delimited) o Quiet time preference (int ranging from 0 to 10) o Music preference (int ranging from 0 to 10) o Reading preference (int ranging from e to 10) o Chatting preference (int ranging from 0 to 19) . For each line in the text fle o Extract the information for each student o Create a Student object pointed to be an entry in the array o Keep a count of actual number of students less than 100) * For each student in the array (after completely done reading) Check against every other student (assuming they are not matched already) their compatibility scores Find the Best Score and Best Match person Match the two roommates up and print out the result o o o Note: Your algorithm for mat g should work something lke t Foreach student NOT currently matched Foreach rest of students NOT currently matched currentScore studentA . compare (studentB) if the currentScore is better than MaxScore bestMatchStudent is student bestMatchScore is currentScore studentA is now Matched bestMatchStudent is now Matched Also note that you have an array of students presumably. So studentA.compare(studentB) will actually look something lke this if(!students[j].getMatched()) I/ student not matched already currentScore students[i].compare(students[j]); In the code above, i is the index of the outer loop, j is the index of the inner loop, and getMatched() is the accessor method for matched. Match class Write a Match class that with main()) that performs the following functions . Create an array of students max = 100) * Read all student information (tab delimited) from a text fle o Nam (String) o Gender (char) o Birthdate (String: Month-Day-Year, hyphen '' delimited) o Quiet time preference (int ranging from 0 to 10) o Music preference (int ranging from 0 to 10) o Reading preference (int ranging from e to 10) o Chatting preference (int ranging from 0 to 19) . For each line in the text fle o Extract the information for each student o Create a Student object pointed to be an entry in the array o Keep a count of actual number of students less than 100) * For each student in the array (after completely done reading) Check against every other student (assuming they are not matched already) their compatibility scores Find the Best Score and Best Match person Match the two roommates up and print out the result o o o Note: Your algorithm for mat g should work something lke t Foreach student NOT currently matched Foreach rest of students NOT currently matched currentScore studentA . compare (studentB) if the currentScore is better than MaxScore bestMatchStudent is student bestMatchScore is currentScore studentA is now Matched bestMatchStudent is now Matched Also note that you have an array of students presumably. So studentA.compare(studentB) will actually look something lke this if(!students[j].getMatched()) I/ student not matched already currentScore students[i].compare(students[j]); In the code above, i is the index of the outer loop, j is the index of the inner loop, and getMatched() is the accessor method for matched

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!