Question: 3. In the following problems chose from: Smells Duplicate Code Long Function Long Parameter List Primitive Obsession Large Class Data Class Design Principle Abstraction Encapsulation




3. In the following problems chose from: Smells Duplicate Code Long Function Long Parameter List Primitive Obsession Large Class Data Class Design Principle Abstraction Encapsulation Modularity Hierarchy Separation of Concerns 3.1. in the following code are primarily the result of The code smells and a violation of the principle of Clearly describe a refactoring step to remove the violation. 1 to 2 sentence. 15 points. public class Register { public void addStudent (int class_id, int age, int height, int student_id) { // adds a student } public void dropStudent (int class_id, int age, int height, int student id) { // drops a student } } The following code has the code smell How does the following code violate abstraction? 1 to 2 sentence. How does the following code violate encapsulation? 1 to 2 sentence. Clearly describe a refactoring step to improve the code. 1 to 2 sentence. 20 points. public class EventSchedule { public int month; public int date; public String day; public int hour; public int minute; } The code smells and a violation of the principles of in the following code are primarily the result of and Clearly describe a refactoring step to remove the violation of the first principle. 1 to 2 sentence. Clearly describe a refactoring step to remove the violation of the second principle (note: the refactoring steps for each principle can be performed incrementally). 1 to 2 sentence. pubic class PairedAverage { private int[] arl; private int[] ar2; public void calculateEverything ( ) { int ansl = 1; int divl = 0; for (int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
