The following is the code of a service that Universities Canada, a consultancy firm for University...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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) 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)
Expert Answer:
Answer rating: 100% (QA)
Strategy Pattern Solution First lets create an interface for the strategy public interface Universit... View the full answer
Related Book For
Operations Management Creating Value Along the Supply Chain
ISBN: 978-1118301173
1st Canadian Edition
Authors: Roberta S. Russell, Bernard W. Taylor, Ignacio Castillo, Navneet Vidyarthi
Posted Date:
Students also viewed these programming questions
-
Sally consumes only two goods, shoes and "everything else." For five different shopping trips (each with different prices), the prices and Sally's marginal utilities are shown below. a. Is Sally...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
A load must be suspended 6 m below a high ceiling using cables attached to two supports that are 2 m apart (see figure). How far below the ceiling (x in the figure) should the cables be joined to...
-
What are investment returns? What is the return on an investment that costs $1,000 and is sold after one year for $1,100?
-
A stream of ammonia enters a steady flow device at 100 kPa, 50C, at the rate of 1 kg/s. Two streams exit the device at equal mass flow rates; one is at 200 kPa, 50C, and the other as saturated liquid...
-
What is the problem with achieving rapidly traveling action potentials through large numbers of giant axons?
-
Two athletes of equal ability are competing for a prize of $10,000. Each is deciding whether to take a dangerous performance-enhancing drug. If one athlete takes the drug, and the other does not, the...
-
Sphere foods company produces a candy called "little Stars," a bag of dozen, individually wrapped, star-shaped candies made primarily from a blend chocolate, macadamia nuts, and a blend of heavy...
-
Steam enters a turbine at 9 MPa, 600C, and 60 m/s and leaves at 20 kPa and 90 m/s with a moisture content of 5 percent. The turbine is not adequately insulated, and it estimated that heat is lost...
-
dx You are given the differential equation + y lnx = x e y (1) = 0 If the value of y(2) can be written in the form e + a be and the initial condition determine the value of a + b.
-
(a) Complete the following truth table. a b -a T T T F F T F F -b (-b) (b) Give a parse tree for the following Boolean expression avb)
-
One-Month Project: Ellipses Corp.Ellipses Corp. is a small business that operates in Herndon, VA. The company is locatedat 10 Period Lane, Herndon, VA 20170. Its federal Employer Identication Number...
-
Keetch v. Kroger Co. Give the style (abbreviated name of the parties) of the case and its citation (Volume, reporter, and page number). In the case you found, how was the customer injured? Provide...
-
class Car private String model; private double price; i ii - - //default constructor //constructor with 2 parameters iii- //set method for model iv - //set method for price v //method print() public...
-
How do postcolonial literary theories critique colonial legacies, cultural imperialism, and the representation of the Other in literature, foregrounding marginalized voices and challenging...
-
A company is considering producing some new Gameboy electronic games. Based on past records, management believes that there is a 70 percent chance that each of these will be successful, and a 30...
-
Which of the following statements is false? a. Capital leases are not commonly reported in a Capital Projects Fund. b. A governmental entity may report a Capital Project Fund in one year but not the...
-
The Carry-Haul Truck Rental firm has accumulated extra trucks at three of its truck leasing outlets, as shown: Leasing Outlet Extra Trucks 1. Toronto .............................................. 70...
-
The Ontario Ministry of Transportation is undertaking a construction project to widen a large section of high-way near Ottawa, which includes the construction of a number of new bridges,...
-
The amount of denim used daily by the Southwest Apparel Company in its manufacturing process to make jeans is normally distributed with an average of 4000 metres of denim and a standard deviation of...
-
According to the National Association for College Admissions Counseling and USA Today, 19.8% of college students take at least one class online. What is the probability of randomly selecting a...
-
A: When a month is randomly selected and ripped from a calendar and destroyed, it is July. B: When a different month is randomly selected and ripped from a calendar, it is November. Independent and...
-
A: When one of the 222 coins listed in Data Set 21 is randomly selected, it is one of the 5 Indian pennies. B: When another one of the 222 coins listed in Data Set 21 is randomly selected, it is also...
Study smarter with the SolutionInn App