In this task, you will implement almost a full code. Your computer is some kind of a facade for you as a user, or, as developers put it, a client. Let's create a simple ComputerFacade with Processor, Monitor and Keyboard subsystems. When you turn on this computer, the Processor will start first, then the Monitor, and finally, the Keyboard. But be careful because your keyboard has a backlight feature, and the order of turning the elements off should be correct!
Facade
Computer Facade
Report a typo
Sample Input 1:
Sample Output 1:
Processor on
Monitor on
Keyboard on
Backlight is turned on
Keyboard off
Backlight is turned off
Monitor off
Processor offWrite a program in Java 17
class ComputerFacadeTestDrive {
public static void main(String[] args) {
/* Your subsystems */
ComputerFacade computerFacade = /* Write your code here */
computerFacade.turnOnComputer();
computerFacade.turnOffComputer();
}
}
class ComputerFacade {
/* Your subsystems */
public ComputerFacade(/* Write your code here */) {
/* Write your code here */
}
public void turnOnComputer() {
/* Write your code here */
}
public void turnOffComputer() {
/* Write your code here */
}
}
class Processor {
/* Your subsystem description */
public void on() {
/* Write your code here */
}
public void off() {
/* Write your code here */
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.