private double[] frequency;
const int MaxVolume = 20;
private Channels channel;
public override string ToString()
frequency= new double[]{89.7,92.5,97.3,100.5,102.6,107.7};
return string.Format("Your radio now is {0}",(Conditions) Convert.ToInt32(cond));
return string.Format("Your radio now is {0}, channel is {1},frequency is {2} volume is {3}", (Conditions) Convert.ToInt32(cond), channel,frequency[(int)channel], volume);
public void ChangeChannelUP()
channel=(Channels)(((int)channel+1)%Enum.GetValues(typeof(Channels)).Length);
public void ChangeChannelDown()
channel = (Channels)((Convert.ToInt32(!Convert.ToBoolean((int)channel)))*Enum.GetValues(typeof(Channels)).Length + ((int)channel-1));
public string GetChannel()
return channel.ToString();
public void pushSwitcher()
public string GetFrequency()
frequency= new double[]{89.7,92.5,97.3,100.5,102.6,107.7};
return (frequency[(int)channel].ToString());
public static void Main()
FmRadio myRadio= new FmRadio();
Console.WriteLine(myRadio);
Console.WriteLine("push ON/OFF button - 1; channel UP - 2; channel DOWN- 3, volume UP - 4, volume DOWN -5");
userChoice = Console.ReadLine();
myRadio.ChangeChannelUP();
myRadio.ChangeChannelDown();