You are to complete a class named CustomerCollection that implements a collection of customers using an array with up-by-one promotion whose insert and remove semantics 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).
Once you implement the insert method and run InsertTester, you should see the following output:
Initial customer collection is empty... CustomerCollection[ numCustomers=0/length=1 ] INSERTION TESTS... ] 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) ]
Once you implement the remove method and run RemoveTester, you should see the following output:
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 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 ]
Once you implement the filter method and run FiltertTester, you should see the following output:
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) ] FILTER TESTS... Create a new collection of customers who used at least 120 minutes. CustomerCollection[ numCustomers=4/length=4 customer[0]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[1]= Lynette Johnson,Business,5 cents/min,200 minutes,1 phone line(s) customer[2]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) customer[3]= Joseph Barnes,Residential,8 cents/min,150 minutes,1 phone line(s) ] Create a new collection of customers who used at least 200 minutes. CustomerCollection[ numCustomers=3/length=4 customer[0]= Mary Smith,Business,4 cents/min,300 minutes,2 phone line(s) customer[1]= Lynette Johnson,Business,5 cents/min,200 minutes,1 phone line(s) customer[2]= Fred Beatty,Residential,9 cents/min,250 minutes,1 phone line(s) ] Create a new collection of customers who used at least 350 minutes. CustomerCollection[ numCustomers=0/length=1 ]