Question: JAVA : Define the missing method. Use this to distinguish the local member from the parameter name. CODE BELOW // ===== Code from file CablePlan.java
JAVA : Define the missing method. Use "this" to distinguish the local member from the parameter name. CODE BELOW
// ===== Code from file CablePlan.java ===== public class CablePlan { private int numDays;
// FIXME: Define setNumDays() method, using "this" implicit parameter. public void setNumDays(int numDays) {
this.numDays = numDays; return; } public int getNumDays() { return numDays; } }
}
public int getNumDays() { return numDays; } } // ===== end =====
// ===== Code from file CallCablePlan.java ===== public class CallCablePlan { public static void main (String [] args) { CablePlan house1Plan = new CablePlan();
house1Plan.setNumDays(30); System.out.println(house1Plan.getNumDays());
} } // ===== end =====
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
