package Wednesday; public abstract class TV { private static final int DIAGONAL_LENGTH = 10; private static final String BRAND = "cmsc131"; private int diagonalLength; private String brand; private int channelNum; /* Relying on the general constructor to implement the */ /* the following two constructors. */ public TV() { this(DIAGONAL_LENGTH, BRAND); } public TV(String brand) { this(DIAGONAL_LENGTH, brand); } /* Most general Constructor */ public TV(int diagonalLength, String brand) { this.diagonalLength = diagonalLength; this.brand = brand; channelNum = 1; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public int getDiagonalLength() { return diagonalLength; } public void setDiagonalLength(int diagonalLength) { this.diagonalLength = diagonalLength; } public String toString() { return "Brand: " + brand + ", Diagonal Length: " + diagonalLength; } /* Notice this method calls an abstract method */ /* to be implemented by a subclass. */ public void changeChannel(int channelNum) { this.channelNum = channelNum; processAndDisplaySignal(); } public int changeChannel(double channelNum) { return 1; } /* Can we defined the access specifier to be private? */ protected abstract void processAndDisplaySignal(); public static void main(String[] args) { /* Are the two following statements allowed? */ /*TV tvSet1 = new TV(); System.out.println(tvSet1);*/ } }