Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            int            maxPhoneNum = 380000;
            MobileOperator Verizon     = new MobileOperator(maxPhoneNum);

            Console.WriteLine("How sms are working:");
            ShowSms(Verizon);

            Console.WriteLine("Press any key to see how calls are working:");
            Console.ReadLine();
            ShowCalls(Verizon);

            Console.WriteLine("Press any key to see how stats are working:");
            Console.WriteLine("Caution! 100 random calls and messages will be generated!");
            Console.ReadLine();
            ShowStatistics(Verizon);

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public static void ShowSms(MobileOperator mobileOperator)
        {
            MobileAccount firstSubscriber   = new MobileAccount(mobileOperator, 1);
            MobileAccount secondSubscriber  = new MobileAccount(mobileOperator, 2);
            MobileAccount anotherSubscriber = new MobileAccount(mobileOperator);

            Console.WriteLine("Number generated automatically for third subscriber: {0}",
                              anotherSubscriber.Number);

            secondSubscriber.AddNumberToPhoneBook(1, "Ramin Djavadi");
            firstSubscriber.AddNumberToPhoneBook(2, "Jonathan Nolan");

            Console.WriteLine("\nSms from someone you know:");
            firstSubscriber.SendSms(2, "Hello, how 're you?");
            secondSubscriber.SendSms(1, "Fine, thanks");

            Console.WriteLine("\nSms from someone you don't:");
            anotherSubscriber.SendSms(1, "Where's my money?");

            Console.WriteLine();
        }
Ejemplo n.º 3
0
 public MobileAccount(MobileOperator mobileOperator) :
     this(mobileOperator, mobileOperator.GetFreeNumber())
 {
 }