Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following is the code of a service that Universities Canada, a consultancy firm for University administrators, is offering to customers for retrieving University
The following is the code of a service that Universities Canada, a consultancy firm for University administrators, is offering to customers for retrieving University data for analyses, publications, articles etc. Assume that the object is used by various clients including York University and the University of Waterloo. public class UniInfo { } public int getStudent No (String university) { int istNo; } switch (university) { case "York University": istNo = 55,000; case "University of Waterloo": istNo = 41,000; default: ist No = -1; // error } return (istNo); Apply the Strategy pattern to make the solution compliant to the Single Responsibility Principle (SRP). In particular: 1. Submit a Class diagram describing your Strategy solution. 2. Update and complete the Client code in the answer box below. 3. Explain (in the answer box) why the original design did not meet the SRP and how the strategy solution satisfies SRP. (50 words max)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Strategy Pattern Solution First lets create an interface for the strategy public interface Universit...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started