// oop designs
        // prototypes


        public override void Execute()
        {
            _screen.WriteLine("Enter the amount to withdraw");
            decimal cash = _keypad.ReadLine();

            _account.Withdraw(cash);
        }
Esempio n. 2
0
        public override void RouetSelection()
        {
            _screen.WriteLine("Enter 1 for Child; Otherwise Adult ");
            long passenger_type = _keyPad.ReadLine();

            if (passenger_type == 1)
            {
                cost          = childCost;
                passengertype = true;
            }
            else
            {
                cost = adultCost;
            }
            _screen.WriteLine("Enter the number of Passengers: ");
            totalpassengers = (int)_keyPad.ReadLine();
        }
Esempio n. 3
0
        public override void Execute()
        {
            _screen.WriteLine($"Enter the amount to deposit");
            decimal amount = _keypad.ReadLine();

            if (depositSlot.IsDepositEnvelopeReceived())
            {
                _account.Deposit(amount);
                _screen.WriteLine($"Deposit Amount {amount:C} is successful!!");
            }
            else
            {
                _screen.WriteLine($"You did not insert the deposit envelope.Transaction cancelled");
            }
        }
Esempio n. 4
0
        public override void Execute()
        {
            _screen.WriteLine("Enter the amount to withdraw");
            decimal amount = _keypad.ReadLine();

            if (cashDispenser.IsCashAvailable(amount))
            {
                _account.Withdraw(amount);
                cashDispenser.BalanceCashInDispenser(amount);
                _screen.WriteLine($"Your withdraw amount {amount:C} is  successful");
            }
            else
            {
                _screen.WriteLine($"No cash available.Try to reduce withdrawal amount");
            }
        }
 public void Start()
 {
     while (true)
     {
         _screen.WriteLine("Welcome!!!\n Enter the account number");
         int accountNum = _keypad.ReadLine();
         _screen.WriteLine("Enter the Pin");
         int pin = _keypad.Read(4);
         _account = Account.Fetch(accountNum, pin);
         if (_account != null)
         {
             Menu();
             _screen.WriteLine($"Thank you for  visiting our ATM..!");
         }
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Start the ATM process
        /// </summary>
        /// <returns>true if successful</returns>
        public bool Start()
        {
            _screen.WriteLine("Welcome. Enter your account number");
            int acct = _keypad.ReadLine();

            _screen.WriteLine("Enter your 4-digit pin code");
            int pin = _keypad.Read(4);

            // _screen.WriteLine($"The account number is {acct}. Pin number is {pin}");
            _account = Account.Fetch(acct, pin);
            if (_account != null)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
 public override void RouetSelection()
 {
     _screen.WriteLine("Enter the number of Passengers: ");
     totalpassengers = (int)_keyPad.ReadLine();
 }
Esempio n. 8
0
        public void Main()
        {
            try
            {
                _screen.WriteLine("Hello!! Welcome to Hawaiian Kiosk. This application helps you book the mode of travel \n which you would prefer to travel between the Hawaian Islands \n");
                _screen.WriteLine("\nSo let's select the best mode of travel and route for you!! \n");
                Routes[] routes = new Routes[]
                {
                    new Ferry1(_screen, _keyPad),
                    new Ferry2(_screen, _keyPad),
                    new Flight1(_screen, _keyPad),
                    new Flight2(_screen, _keyPad),
                    new Flight3(_screen, _keyPad)
                };
                _screen.WriteLine("     1 - Ferry goes from Maui to Lanai or vice versa for $30.00 (Adult) $20.00 (Child)");
                _screen.WriteLine("     2 - Ferry goes from Maui to Lanai or vice versa for $40.00 (Adult) $20.00 (Child)");
                _screen.WriteLine("     3 - Flight goes from Honolulu to Maui or vice versa for $80.00");
                _screen.WriteLine("     4 - Flight goes from Honolulu to Maui or vice versa for $100.00");
                _screen.WriteLine("     5 - Flight goes from Honolulu to Maui or vice versa for 50.00");
                _screen.WriteLine("     0 - Exit\n");
                int choice = (int)_keyPad.ReadLine();
                switch (choice)
                {
                case 1:
                    _screen.WriteLine($"Enter 1 if you want to travel from {routes[0].From} To {routes[0].To}. Else if you want to travel from {routes[0].To} to {routes[0].From} press other number");
                    direction = (int)_keyPad.ReadLine();
                    routes[0].RouetSelection();
                    if (direction != 1)
                    {
                        _screen.WriteLine($"Route Summary- {routes[0].MenuName} from {routes[0].To} to {routes[0].From} -> Cost for {routes[0].numberofPassengers} is {routes[0].numberofPassengers} X ${routes[0].Price} = ${routes[0].TotalPrice}");
                    }
                    else
                    {
                        _screen.WriteLine(routes[0].ToString());
                    }
                    totalamount = routes[0].TotalPrice;
                    SelectPaymentMethod(totalamount);
                    break;

                case 2:
                    _screen.WriteLine($"Enter 1 if you want to travel from {routes[1].From} To {routes[1].To}. Else if you want to travel from {routes[1].To} to {routes[1].From} press other number");
                    direction = (int)_keyPad.ReadLine();
                    routes[1].RouetSelection();
                    if (direction != 1)
                    {
                        _screen.WriteLine($"Route Summary- {routes[1].MenuName} from {routes[1].To} to {routes[1].From} -> Cost for {routes[1].numberofPassengers} is {routes[1].numberofPassengers} X ${routes[1].Price} = ${routes[1].TotalPrice}");
                    }
                    else
                    {
                        _screen.WriteLine(routes[1].ToString());
                    }
                    totalamount = routes[1].TotalPrice;
                    SelectPaymentMethod(totalamount);
                    break;

                case 3:
                    _screen.WriteLine($"Enter 1 if you want to travel from {routes[2].From} To {routes[2].To}. Else if you want to travel from {routes[2].To} to {routes[2].From} press other number");
                    direction = (int)_keyPad.ReadLine();
                    routes[2].RouetSelection();
                    if (direction != 1)
                    {
                        _screen.WriteLine($"Route Summary- {routes[2].MenuName} from {routes[2].To} to {routes[2].From} -> Cost for {routes[2].numberofPassengers} is {routes[2].numberofPassengers} X ${routes[2].Price} = ${routes[2].TotalPrice}");
                    }
                    else
                    {
                        _screen.WriteLine(routes[2].ToString());
                    }
                    totalamount = routes[2].TotalPrice;
                    SelectPaymentMethod(totalamount);
                    break;

                case 4:
                    _screen.WriteLine($"Enter 1 if you want to travel from {routes[3].From} To {routes[3].To}. Else if you want to travel from {routes[3].To} to {routes[3].From} press other number");
                    direction = (int)_keyPad.ReadLine();
                    routes[3].RouetSelection();
                    if (direction != 1)
                    {
                        _screen.WriteLine($"Route Summary- {routes[3].MenuName} from {routes[3].To} to {routes[3].From} -> Cost for {routes[3].numberofPassengers} is {routes[3].numberofPassengers} X ${routes[3].Price} = ${routes[3].TotalPrice}");
                    }
                    else
                    {
                        _screen.WriteLine(routes[3].ToString());
                    }
                    totalamount = routes[3].TotalPrice;
                    SelectPaymentMethod(totalamount);
                    break;

                case 5:
                    _screen.WriteLine($"Enter 1 if you want to travel from {routes[4].From} To {routes[4].To}. Else if you want to travel from {routes[4].To} to {routes[4].From} press other number");
                    direction = (int)_keyPad.ReadLine();
                    routes[4].RouetSelection();
                    if (direction != 1)
                    {
                        _screen.WriteLine($"Route Summary- {routes[4].MenuName} from {routes[4].To} to {routes[4].From} -> Cost for {routes[4].numberofPassengers} is {routes[4].numberofPassengers} X ${routes[4].Price} = ${routes[4].TotalPrice}");
                    }
                    else
                    {
                        _screen.WriteLine(routes[4].ToString());
                    }
                    totalamount = routes[4].TotalPrice;
                    SelectPaymentMethod(totalamount);
                    break;

                case 0:
                    break;
                }
            }
            catch (Exception ex)
            {
                _screen.WriteLine(ex.ToString());
            }
        }