Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
HW6j_Java.docx 08/09/19) 
CISC 1115 
Brooklyn College 
Professor Langsam 
 
Assignment Six 
A very mixed up dating service needs your help desperately. They have two files of couples 
(husbands.txt and women.txt) they have matched up and married, one of the husband’s names 
and one of the women’s names, but they don’t know which of the women match which of the 
husbands. They need a list of all pairs – husbands and wife, and which women have not yet 
found a match yet. 
Write a complete Java program, with comments, to do the following: 
1. Determine the number of husbands (there will be no more than 25). For each husband, 
store this information in three arrays:  firstName, lastName, and address. 
2. After you have read all the information for the husbands, call a method, sort, to sort the 
information by last name. 
 
3. Next process the file of women. For each woman in the file do the following: 
 
a. Read in the woman’s last name, first name and address.  
b. Call a method match which will try to match the woman to one of the husbands from 
the list. To do this, the method needs the arrays of husbands, how many there are, and 
the information on this woman. A woman matches one of the husbands if the last 
name and address are the same. Search through the array to find a match. If there is a 
match, return the number of the position in the array, and return to the main method. 
If no match is found after searching the entire list, return the value -1. 
c. In the main method if the value -1 is returned, print on a new line, the woman’s 
information and a message that she has not yet found a match. Otherwise, (a match 
has been found), print on a new line, the woman’s last name, her first name, and her 
husband’s first name. 
d. Repeat step three for each woman. 
 
 
Programming notes: 
1. You may use the next() methods to read the first and last name and then the nextLine() 
method to read the rest of the line containing the address. 
HW6j_Java.docx 08/09/19) 
2. You should use the String trim() method to remove the leading and trailing blanks ftom 
the address. 
3. The women are processed one at a time, they are not placed into an array 
4. The only class variables are any constants and PrintStream 
5. You may use either a sequential or binary search in your match method. 
 
 
 
Data: 
 
 Husbands 
 
Bruce  Wayne   The Batcave 
Sonny  Bono   10 Mayor Street 
Clint   Eastwood  2020 Make My Day Drive 
Jimmy  Carter   1010 Peanut Street 
Mike   Tyson   2525 Robin Court 
Mickey  Mouse   6000 Mickey Lane 
Abe   Lincoln  900 Booth Street 
Scrooge McDuck  7011 McDuck Drive 
Ed  Koch   125 E. 125th Street 
Barney  Rubble   1001 Old Stone Age Road 
 
 Women 
 
Linda  Eastwood  2020 Make My Day Drive 
Cher  Bono   10 Mayor Street 
Ava  Gabor   9238 Parkside 
Wendy  Banks   17 Cherry Tree Lane 
Lady  Darling  200 Tramp Court 
Daisy  Duck   95 Donald Street 
DeeDee McCall  21 Hunter Avenue 
Roseanne Barr   1000 Fat Lane 
Lily  Munster  1313 Mockingbird Lane 
Minnie  Mouse   6000 Mickey Lane 
Lois  Lane   2192 Superman Blvd 
Betty   Ford   100 Happy Hour Drive 
Mary  Lincoln  900 Booth Street 
Betty  Rubble   1001 Old Stone Age Road 
Robin  Givens   800 Hollywood Blve