Method createInvoice generates a string that is printed in a JOptionPane dialog box. If the customer is type SILVER, the base cost is $25. If the customer is type GOLD, the base cost is $30. If the customer is type PLATINUM, the base cost is $35. createInvoice calls calculateCharge to add the video and test cost to the base cost.
calculateCharge charges $1 for each video if customer type is SILVER and $.50 for each test. If the customer is type GOLD, each video is $.50 and each test is $.25. There is no extra charge if the customer is type PLATINUM.
ArrayList lessonList keeps a list of all vides watched and tests taken by the customer.
Write test case, CustomerTest, that creates two customers with the data given. The customers are kept in ArrayList, customerList. Then, using an enhanced for loop, polymorphically walk through the customerList and create the invoice for each customer. Print all customer’s charges in a dialog box as shown.