示例#1
0
 static void Main(string[] args)
 {
     Amplifier machine = new Amplifier();
     while(true)
     {
         Console.WriteLine("Welcome to the Pavels Amplifier!");
         Console.WriteLine("--------------------------------");
         Console.WriteLine("The Volume Level is {0} ", machine.Volume);
         Console.WriteLine("--------------------------------");
         Console.Write("Set The New Volume Level, Please:> ");
         machine.Volume = int.Parse(Console.ReadLine());
         Console.WriteLine("--------------------------------");
     }
 }
示例#2
0
文件: Program.cs 项目: Mgrmjp/Demo04
        static void Main(string[] args)
        {
            Amplifier amplifier = new Amplifier();

            int luku;

            do
            {
                Console.WriteLine("Volume is currently > " + amplifier.Volume);
                Console.Write("Give a new volume value (0-100) > ");
                string line = Console.ReadLine();
                luku = int.Parse(line);

                amplifier.Volume = luku;

                Console.WriteLine();
            } while (luku != -1);
        }
示例#3
0
文件: Program.cs 项目: K8920/Demo04
        static void Main(string[] args)
        {
            Amplifier amp = new Amplifier();

            Console.WriteLine("You can change the volume level between 1 and 100");
            Console.WriteLine("Entering value 0 turns off the amplifier");
            Console.WriteLine("Current volume: " + amp.Volume);
            Console.WriteLine("Please enter wanted volume level");
            int power = 1;

            do
            {
                string line = Console.ReadLine();
                amp.Volume = int.Parse(line);
                power      = int.Parse(line);
                Console.WriteLine("---------------");
                Console.WriteLine("Current Volume: " + amp.Volume + "db");
                Console.WriteLine("---------------");
            }while (power != 0);
        }
示例#4
0
        static void Main(string[] args)
        {
            int       number = 0;
            Amplifier amp    = new Amplifier();

            while (true)
            {
                Console.Write("Give a new volume value (0-100) > ");
                bool result = Int32.TryParse(Console.ReadLine(), out number);
                if (result)
                {
                    amp.Volume = number;
                }
                else
                {
                    Console.WriteLine("Not a number!");
                    continue;
                }
            }
        }