April 2019
Intermediate to advanced
360 pages
9h 17m
English
The Printer class has a single class variable, printerState. It contains constructor, accessor, and mutator methods. Here is the Printer class source code:
public class Printer { // class variable private PrinterController printerState; // constructor public Printer(PrinterController pState) { this.printerState = pState; } // accessor / getter public PrinterController getPrinterState() { return printerState; } // mutator / setter public void setPrinterState(PrinterController pState) { this.printerState = pState; } public void pushPrint() { printerState.pushPrint(this); }}
The Printer class also contains the pushPrint() method, which simulates pushing a printer's power button.
Read now
Unlock full access