Advertisement
aslen

Untitled

Mar 5th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Linq;
  4.  
  5. namespace Hw5
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             TvOnOrOff tvSet = new TvOnOrOff();
  12.             bool tvOn = tvSet.turnOn();
  13.             if (tvOn)
  14.             {
  15.                 ChoiceTvProgram program = new ChoiceTvProgram();
  16.                 string choiceProg = program.TvProg();
  17.                 Console.WriteLine("We choice chanel {0}", choiceProg);
  18.             }
  19.  
  20.             Console.ReadLine();
  21.         }
  22.     }
  23.     class TvOnOrOff
  24.     {
  25.         public bool turnOn()
  26.         {
  27.             Console.WriteLine("Turn on Tv 1) On 2) Off");
  28.             int turnOn = int.Parse(Console.ReadLine());
  29.  
  30.             if (turnOn == 1)
  31.             {
  32.                 return true;
  33.             }
  34.             else
  35.                 return false;
  36.         }
  37.  
  38.     }
  39.     class ChoiceTvProgram
  40.     {
  41.         public string TvProg()
  42.         {
  43.             int resaultChanel = inputChanel();
  44.             switch (resaultChanel)
  45.             {
  46.                 case 1: return "Inter";
  47.                 case 2: return "1+1";
  48.                 case 3: return "STB";
  49.                 case 4: return "Noviy";
  50.                 case 5: return "ICTV";
  51.                 case 6: return "Ukraina";
  52.                 case 7: return "2+2";
  53.                 case 8: return "Simon";
  54.                 case 9: return "OTB";
  55.                 case 10: return "K1";
  56.                 default: return "Incorrect enter program ";
  57.             }
  58.         }
  59.         private int inputChanel()
  60.         {
  61.             Console.WriteLine("Input number chanel to 1 from 10: ");
  62.             int inputProgram = int.Parse(Console.ReadLine());
  63.             return inputProgram;
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement