예제 #1
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        public static void Main()
        {
            DatabaseBuilder databaseBuilder = new DatabaseBuilder();
            CarCreator      carCreator      = new CarCreator();
            Accountant      accountant      = new Accountant();

            do
            {
                try
                {
                    carCreator.Create();
                    databaseBuilder.Build();
                    Console.WriteLine("Press Esc to end input. Press Enter to continue input");
                }
                catch (Exception error)
                {
                    Console.WriteLine("Build error: " + error.Message);
                }
            } while (Console.ReadKey().Key != ConsoleKey.Escape);
            string inputCommand = Interviewer.GetObjInterviewer().AskCommand();

            if (inputCommand == "exit")
            {
                Environment.Exit(0);
            }
            else
            {
                Console.WriteLine(accountant.GetResultOfQuery(inputCommand));
            }
        }
예제 #2
0
 /// <summary>
 /// Ensures that only one object is created for the class.
 /// </summary>
 /// <returns>The object of interviewer.</returns>
 public static Interviewer GetObjInterviewer()
 {
     if (objIntereviewer == null)
     {
         objIntereviewer = new Interviewer();
     }
     return(objIntereviewer);
 }