CS 410/510 Software Design Patterns, Winter 2021, Midterm, Feb. 3rd. This is an open book, individual exam. Properly cite any part of your solution that is not your own creation. You should not discuss this exam with anyone before you submit your solution. Please read these instructions carefully. This exam is in two parts. Both parts will be graded. You will complete the first part in class in one hour and email your work to the instructor. You will complete the second part at home and email your work to the instructor by Thursday at 10AM. Substantially late work will incur a substantial penalty. The attached program is an Abstract Factory pattern similar to, actually simpler than, quiz 1. There are only two products, P1 and P2, and only one family identified by suffix "_A" is coded. You should regards the program as if there were more products and more concrete factories even though they are not shown in the code. Part 1, in class, there are two steps. Send an email of your work for each step. ----------------------------------------- Step 1. ------- Modify the program so that Factory_A becomes both a Singleton and an Immutable object. Please make only the minimum required changes. Don't reformat or beautify my code! Don't split it in multiple files. Don't add comments. I will use a diff file tool to understand your work and unnecessary changes will make my work more difficult. Email the program with only this change. Step 2. ------- Extend the functionality of the program of step 1 so that its execution keeps track, for each family and for each product, of how many units are created. This should include a method for reporting this information, e.g., for the proposed example, something like: Factory_A P1 #1 P2 #0 The focus is on the information, not the formatting, so approximations of the above are perfectly fine. Your solution should be general in the sense that it should work (largely unchanged) no matter how many products and/or concrete factories there are. Of course, the code of the factories and products should not be changed. No one wants to re-design, re-code, re-test, and re-document code that works fine. Also no one wants to add more responsibilities to factories and products. Your solution should also be "gentle" with the respect to changes required in the client. You will need new classes and/or methods to provide the extended functionality. It is your job to design these classes and methods. I recommend that you do not attempt to code the body of these methods in class. Rather you should state in a comment what the body of each of these methods intends to accomplish. In other words, no comment loses points. Email this program at the end of the in-class exam. Part 2, take home. ------------------ Complete the program and email it to the instructor by 10AM on Thursday Feb 4th. If your take-home submission is radically different from your in-class submission, please tell me what you are changing and why. There are various reasonable design options for the classes and methods required for the extension. If you consider alternative designs, please briefly describe them with their pros anc cons.