Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Radio extends HomeAppliances implements Runnable {
- public int channel;
- public int volume;
- public String type;
- public Radio(boolean isOn, double consumption, int voltage, int channel, int volume, String type, int id) {
- super(isOn, consumption, voltage, id);
- this.channel = channel;
- this.volume = volume;
- this.type = type;
- }
- @Override
- public void run() {
- synchronized(this) {
- System.out.println("Rádio de ID: " + super.getId() + "; Ligado: " + super.isOn() + "; Consumo: " + super.getConsumption() + "; Voltagem: " + super.getVoltage() + "; Canal: " + getChannel() + "; Volume: " + getVolume() + "; Tipo: " + getType() + ";");
- try {
- Thread.sleep(1000);
- } catch(InterruptedException exception) {
- System.out.println("Thread interrompida.");
- }
- }
- }
- public int getChannel() {
- return channel;
- }
- public int getVolume() {
- return volume;
- }
- public String getType() {
- return type;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement