static void Main(string[] args) { Television volume = new Television(); Console.WriteLine(volume.currentVolume); volume.increaseVolume(); Console.WriteLine(volume.currentVolume); Television channel = new Television(); Console.WriteLine(volume.currentChannel); channel.increaseChannel(); Console.WriteLine(volume.currentChannel); Console.ReadKey(); }
public RemoteController() { InitializeComponent(); remoteControl = new RemoteControl(); television = new Television(); form = new TelevisionDisplay(); form.BringToFront(); form.Show(); form.SetTelevision(television); powerOnOff = new PowerCommand(television); volumeUp = new VolumeCommand(television, true); volumeDown = new VolumeCommand(television, false); channelUp = new ChannelCommand(television, true); channelDown = new ChannelCommand(television, false); }
static void Main(string[] args) { Television myTV1; myTV1 = new Television(); myTV1.marca = "NEC"; myTV1.modelo = "xyz"; myTV1.tamanoPantalla = 52; Television myTV2 = new Television(); myTV2.marca = "Toshiba"; myTV2.modelo = "b328dx"; myTV2.tamanoPantalla = 33; Console.WriteLine("Mi televisor {0} es lindo.", myTV1.marca); Console.WriteLine("Mi televisor {0} mide {1} pulgadas.", myTV1.marca, myTV1.tamanoPantalla); Console.WriteLine(); }
static void Main() { //Instantiate first: var is used as a shorthand for Television //(or whatever type is on the right-hand side) var tv = new Television(); if (tv.IsOn() == false) //If TV is not on, turn it on { tv.TurnOn(); } tv.ChangeChannel(3); tv.IncreaseVolume(); tv.IncreaseVolume(); tv.IncreaseVolume(); tv.IncreaseVolume(); tv.TurnOff(); }
public void SetTelevision(Television television) { this.television = television; }