Question: Question 2. (30 marks) Consider the following code base that follows a bad SOLID principle. State which principle it is violating and why. Fix the


Question 2. (30 marks) Consider the following code base that follows a bad SOLID principle. State which principle it is violating and why. Fix the design of the system so that it follows the stated principle. Submit the changed UML class diagram. Explain what did you change to fix the design to follow that principle. interface Store \{ void addProduct(String productName); void removeProduct(String productName); void updateProduct(String productName); void listProducts(); void searchProduct(String productName); void sellProduct(String productName): \} class ConvenienceStore implements Store \{ private ArrayList products; public ConvenienceStore() \{ products = new ArrayList (); \} @Override public void addProduct(String productName) \{ products.add(productName); \} @Override public void removeProduct(String productName) \{ products.remove(productName); \} @Override public void updateProduct(String productName)\{ II code to update product information \} @Override public void listProducts() \{ // code to list all products @)Override public void searchProduct(String productName) \{ Il code to search for a product \} @Override public void sellProduct(String productName) \{ II code to sell a product \} \} Answer: Violated principle (5 marks): Reason (5 marks): UML class diagram ( 10 marks): Explanation (10 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
