Question: Here is my Test prorgam! public class StoreTestProgram { public static void main(String args[]) { Store s1 = new Store(Walmart off Innes); s1.addCustomer(new Customer(Amie, 14,
Here is my Test prorgam!
public class StoreTestProgram {
public static void main(String args[]) {
Store s1 = new Store("Walmart off Innes");
s1.addCustomer(new Customer("Amie", 14, 'F', 100));
s1.addCustomer(new Customer("Brad", 15, 'M', 0));
s1.addCustomer(new Customer("Cory", 10, 'M', 100));
s1.addCustomer(new Customer("Dave", 5, 'M', 48));
s1.addCustomer(new Customer("Earl", 21, 'M', 500));
s1.addCustomer(new Customer("Flem", 18, 'M', 1));
s1.addCustomer(new Customer("Gary", 8, 'M', 20));
s1.addCustomer(new Customer("Hugh", 65, 'M', 30));
s1.addCustomer(new Customer("Iggy", 43, 'M', 74));
s1.addCustomer(new Customer("Joan", 55, 'F', 32));
s1.addCustomer(new Customer("Kyle", 16, 'M', 88));
s1.addCustomer(new Customer("Lore", 12, 'F', 1000));
s1.addCustomer(new Customer("Mary", 17, 'F', 6));
s1.addCustomer(new Customer("Nick", 13, 'M', 2));
s1.addCustomer(new Customer("Omar", 18, 'M', 24));
s1.addCustomer(new Customer("Patt", 24, 'F', 45));
s1.addCustomer(new Customer("Quin", 42, 'M', 355));
s1.addCustomer(new Customer("Ruth", 45, 'F', 119));
s1.addCustomer(new Customer("Snow", 74, 'F', 20));
s1.addCustomer(new Customer("Tamy", 88, 'F', 25));
s1.addCustomer(new Customer("Ulsa", 2, 'F', 75));
s1.addCustomer(new Customer("Vern", 9, 'M', 90));
s1.addCustomer(new Customer("Will", 11, 'M', 220));
s1.addCustomer(new Customer("Xeon", 17, 'F', 453));
s1.addCustomer(new Customer("Ying", 19, 'F', 76));
s1.addCustomer(new Customer("Zack", 22, 'M', 35));
System.out.println("Here are the customers: ");
s1.listCustomers();
// Find male/female customers
System.out.println(" Here are all the male customers:");
java.util.ArrayList
for (Customer c: result) System.out.println(c);
System.out.println(" Here are all the female customers:");
result = s1.getCustomersOfSex('F');
for (Customer c: result) System.out.println(c);
// Find friends for Amie
System.out.println(" Friends for 14 year old female Amie:");
result = s1.friendsFor(s1.getCustomers().get(0));
for (Customer c: result) System.out.println(c);
// Find friends for Brad
System.out.println(" Friends for 15 year old male Brad:");
result = s1.friendsFor(s1.getCustomers().get(1));
for (Customer c: result) System.out.println(c);
// Remove the broke customers
System.out.println(" Here are the customers after broke ones are removed: ");
s1.removeBrokeCustomers();
s1.listCustomers();
}
}

![main(String args[]) { Store s1 = new Store("Walmart off Innes"); s1.addCustomer(new Customer("Amie",](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3b1ff54ed4_84666f3b1febe19a.jpg)



The Store class contains 4 incomplete methods which you must write as shown below. Upon completing the method test it by running the test case in Store TestProgram. Here are the methods 1. recordPurchase(Customer c, float price) -record the purchase from the customer, and add the customer in the store record. 3. getCustomersOfSex(char sex) returns a list of all Customers in the store that have the same sex as the one specified in the parameter. Use a for (Customer c: customers loop to fill up a newly created ArrayList and return it. 4. friends For(Customer c) returns a list of all Customers in the store that are possible friends for the one specified in the parameter. Customers will be considered "possible friends" if they have the same sex and are within 3 years of age one each other. Use an iterator on the customers ArrayList to fill up a newly created Array List and return it 5. removeBrokeCustomers0 removes all Customers from the store that have less than $10. Use an iterator on the customers ArrayList to remove the appropriate customers. There should not be anything returned from this method. Once you write your code, you should notice that there are 15 males, 11 females, 3 friends for Amie, 4 friends for Brad and 22 remaining non-broke Customers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
