ListQueue
ClassIf you've never heard of Fix-U-Up Inc., it's no surprise. This fly-by-night operation doesn't stay very long in one town. It is able to offer its matching service at a very competitive price because of the very uncomplicated compatibility algorithm it employ. The company keeps two first-in / first-out files: one file of female clients and one of male clients. When a new customer signs up he or she is automatically paired with whomever happens to be at the front of the file of the opposite sex. These files are actually in boxes. This gives the company very fast customer throughput and avoids complicated paperwork.
The shell program to run the matching system is available from your
teacher (fixup.java
). It accepts the names and genders
of clients from the keyboard, and announces a match whenever it
is able to make one. The program terminates when "BBB
"
(Better Business Bureau) is entered as a client name. Your job is to
finish this program which uses the ListQueue
unit.
Sample Output: User input in bold
Welcome to Fix - U - Up Exclusive Dating Service Client Name : Marsha Please type f or m for gender f We don't have a match for you right now, but one is sure to turn up soon. Client Name : Barbie Please type f or m for gender F We don't have a match for you right now, but one is sure to turn up soon. Client Name : John Please type f or m for gender m * * * * * We have a match ! John and Marsha Client Name : Hillary Please type f or m for gender f We don't have a match for you right now, but one is sure to turn up soon. Client Name : Ken Please type f or m for gender M * * * * * We have a match ! Ken and Barbie Client Name : BBB Because of the Better Business Bureau, we left town.