Exemplo n.º 1
0
        static void Main(string[] args)
        {
            int            maxPhoneNum       = 380000;
            MobileOperator Verizon           = new MobileOperator(maxPhoneNum);
            MobileAccount  firstSubscriber   = new MobileAccount(Verizon, 1);
            MobileAccount  secondSubscriber  = new MobileAccount(Verizon, 2);
            MobileAccount  anotherSubscriber = new MobileAccount(Verizon);

            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("\nCalls:");
            anotherSubscriber.MakeCall(1);
            firstSubscriber.MakeCall(2);

            Console.WriteLine("\nSubscribers number: {0}", Verizon.SubscribersCount);
            Console.ReadLine();
        }
Exemplo 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");

            mobileOperator.AddFunds(1, 4);
            mobileOperator.AddFunds(2, 4);
            mobileOperator.AddFunds(anotherSubscriber.Number, 2);

            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();
        }