A phone company customer's account has the following properties:
You are to complete a class named CustomerCollection that implements a collection of phone company customers using an array whose insert and remove operations are explained below. The insert and remove methods both have void as the return type. NOTE: The length of the array and the number of elements in the array at each step must match the given output. The array length should be increased only if the array is full when an insert operation is begun (see sample output).
insert
This method takes one parameter, a Customer to be inserted, and must determine if that Customer is already in the array by searching for the customer's name. If the customer is not in the array, this method stores the new Customer after the last customer currently stored in the array (resizing the array if necessary). If the customer is in the array, move the customer to the front of the array, moving all the intervening customers back by one (if it is already at the front, it just remains there). Use the InsertTester class to test your insert method. See sample output below.
remove
The remove method takes one parameter, a String, specifying the customer name. It searches for this customer in the array by searching for this name. If the customer is not in the array, the array remains unchanged. If the customer is in the array, the customer is removed from the array leaving the order of the remaining customers unchanged (i.e. shift the subsequent customers over one position to fill in the gap made by the removed customer). Use the RemoveTester class to test your remove method. See sample output below.
Initial customer collection is empty... CustomerCollection[ numCustomers=0/length=1 ] INSERTION TESTS... Inserting Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) CustomerCollection[ numCustomers=1/length=1 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) ] Inserting Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) CustomerCollection[ numCustomers=2/length=2 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) ] Inserting Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) CustomerCollection[ numCustomers=3/length=4 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) customer[2]= Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) ] Inserting Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) CustomerCollection[ numCustomers=4/length=4 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) customer[2]= Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) customer[3]= Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) ] Inserting Susan Zimmerman,Residential,8 cents/min,100 minutes,2 phone line(s) CustomerCollection[ numCustomers=5/length=8 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) customer[2]= Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) customer[3]= Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,2 phone line(s) ] Inserting Joseph Barnes,Residential,7 cents/min,150 minutes,2 phone line(s) CustomerCollection[ numCustomers=6/length=8 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) customer[2]= Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) customer[3]= Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,2 phone line(s) customer[5]= Joseph Barnes,Residential,7 cents/min,150 minutes,2 phone line(s) ] Inserting Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) CustomerCollection[ numCustomers=6/length=8 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) customer[2]= Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) customer[3]= Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,2 phone line(s) customer[5]= Joseph Barnes,Residential,7 cents/min,150 minutes,2 phone line(s) ] Inserting Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) CustomerCollection[ numCustomers=6/length=8 customer[0]= Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) customer[1]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[2]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) customer[3]= Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,2 phone line(s) customer[5]= Joseph Barnes,Residential,7 cents/min,150 minutes,2 phone line(s) ] Inserting Bugs Bunny,Business,4 cents/min,25 minutes,1 phone line(s) CustomerCollection[ numCustomers=7/length=8 customer[0]= Fred Beatty,Business,3 cents/min,250 minutes,1 phone line(s) customer[1]= Harry Jones,Residential,8 cents/min,100 minutes,1 phone line(s) customer[2]= Mary Smith,Business,4 cents/min,300 minutes,1 phone line(s) customer[3]= Lynette Johnson,Residential,5 cents/min,200 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,2 phone line(s) customer[5]= Joseph Barnes,Residential,7 cents/min,150 minutes,2 phone line(s) customer[6]= Bugs Bunny,Business,4 cents/min,25 minutes,1 phone line(s) ]
Initial data loaded into CustomerCollection... CustomerCollection[ numCustomers=6/length=8 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,2 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[2]= Lynette Johnson,Business,5 cents/min,200 minutes,1 phone line(s) customer[3]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,1 phone line(s) customer[5]= Joseph Barnes,Residential,8 cents/min,150 minutes,1 phone line(s) ] REMOVAL TESTS... Removing Daffy Duck CustomerCollection[ numCustomers=6/length=8 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,2 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[2]= Lynette Johnson,Business,5 cents/min,200 minutes,1 phone line(s) customer[3]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,1 phone line(s) customer[5]= Joseph Barnes,Residential,8 cents/min,150 minutes,1 phone line(s) ] Removing Joseph Barnes CustomerCollection[ numCustomers=5/length=8 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,2 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[2]= Lynette Johnson,Business,5 cents/min,200 minutes,1 phone line(s) customer[3]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) customer[4]= Susan Zimmerman,Residential,8 cents/min,100 minutes,1 phone line(s) ] Removing Lynette Johnson CustomerCollection[ numCustomers=4/length=8 customer[0]= Harry Jones,Residential,8 cents/min,100 minutes,2 phone line(s) customer[1]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[2]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) customer[3]= Susan Zimmerman,Residential,8 cents/min,100 minutes,1 phone line(s) ] Removing Harry Jones CustomerCollection[ numCustomers=3/length=8 customer[0]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[1]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) customer[2]= Susan Zimmerman,Residential,8 cents/min,100 minutes,1 phone line(s) ] Removing Susan Zimmerman CustomerCollection[ numCustomers=2/length=8 customer[0]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[1]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) ] Removing Lynette Johnson CustomerCollection[ numCustomers=2/length=8 customer[0]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[1]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) ] Removing Mary Smith CustomerCollection[ numCustomers=1/length=8 customer[0]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) ] Removing Fred Beatty CustomerCollection[ numCustomers=0/length=8 ] Removing Susan Zimmerman CustomerCollection[ numCustomers=0/length=8 ]