Question: [ Design Pattern ] 5 5 5 5+5 3. (a) Describe method overloading and overriding with example. (b) Explain the difference between Singleton and Prototype.

[Design Pattern]

[Design Pattern] 5 5 5 5+5 3. (a) Describe method overloading and

5 5 5 5+5 3. (a) Describe method overloading and overriding with example. (b) Explain the difference between Singleton and Prototype. (c) Write short notes on - "Duplicated code" and "Speculative Generality" (d) Consider the following three code snippets - Identify the code smells in the codes and rewrite the codes to remove the smells. i) function getPayAmount() { let result; if (isDead) result = deadAmount(); else { if (isseparated) result = separatedAmount(); else if (isRetired) result = retiredAmount); else result = normalPayAmount(); 3 return result; > ii) switch (bird.type) { case 'European Swallow': return "average": case 'African Swallow': return (bird. number of Coconuts > 2) ? "tired" : "average"; case 'NorwegianBlueParrot': return (bird.voltage > 100) ? "scorched" : "beautiful"; default: return "unknown

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!