Beispiel #1
0
        static void Main(string[] args)
        {
            ApplicationUtilities.DisplayApplicationInformation();
            ApplicationUtilities.DisplayDivider("Program Start");

            Racer[] racerList = new Racer[2];

            racerList[0] = new HotRod();
            racerList[1] = new StreetTuner();

            for (int i = 0; i < 2; i++)
            {
                if (racerList[i] is HotRod)
                {
                    RacerInput.CollectHotRodInformation((HotRod)racerList[i]);
                    RacerOutput.DisplayHotRodInformation((HotRod)racerList[i]);
                }
                else if (racerList[i] is StreetTuner)
                {
                    RacerInput.CollectStreetTunerInformation((StreetTuner)racerList[i]);
                    RacerOutput.DisplayStreetTunerInformation((StreetTuner)racerList[i]);
                }
                else
                {
                    break;
                }
            }

            ApplicationUtilities.TerminateApplication();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            ApplicationUtilities.DisplayApplicationInformation();
            ApplicationUtilities.DisplayDivider("Program Start");

            Racer[] racerList = new Racer[2];

            racerList[0] = new HotRod();
            racerList[1] = new StreetTuner();

            for (int i = 0; i < 2; i++ )
            {
                if (racerList[i] is HotRod)
                {
                    RacerInput.CollectHotRodInformation((HotRod)racerList[i]);
                    RacerOutput.DisplayHotRodInformation((HotRod)racerList[i]);
                }
                else if (racerList[i] is StreetTuner)
                {
                    RacerInput.CollectStreetTunerInformation((StreetTuner)racerList[i]);
                    RacerOutput.DisplayStreetTunerInformation((StreetTuner)racerList[i]);
                }
                else
                    break;
            }

            ApplicationUtilities.TerminateApplication();
        }
Beispiel #3
0
 //method to input Street Tuner information
 public static void CollectStreetTunerInformation(StreetTuner tuner)
 {
     Console.WriteLine();
     ApplicationUtilities.DisplayDivider("Provide the information for the new Street Tuner");
     Console.WriteLine();
     tuner.Name = InputUtilities.GetInput("Racer name");
     tuner.Speed = InputUtilities.getIntegerInputValue("Racer speed");
     tuner.Eng.Cylinders = InputUtilities.getIntegerInputValue("Number of cylinders");
     tuner.Eng.Horsepower = InputUtilities.getIntegerInputValue("Horsepower");
     switch (InputUtilities.getStringInputValue("yes or no option for Has Nitrous"))
     {
         case ("yes"):
             tuner.Nitrous = true;
             break;
         case ("Yes"):
             tuner.Nitrous = true;
             break;
         case("y"):
             tuner.Nitrous = true;
             break;
         case("Y"):
             tuner.Nitrous = true;
             break;
         case("YES"):
             tuner.Nitrous = true;
             break;
         default:
             tuner.Nitrous = false;
             break;
     }
 }
Beispiel #4
0
        //method to input Street Tuner information
        public static void CollectStreetTunerInformation(StreetTuner tuner)
        {
            Console.WriteLine();
            ApplicationUtilities.DisplayDivider("Provide the information for the new Street Tuner");
            Console.WriteLine();
            tuner.Name           = InputUtilities.GetInput("Racer name");
            tuner.Speed          = InputUtilities.getIntegerInputValue("Racer speed");
            tuner.Eng.Cylinders  = InputUtilities.getIntegerInputValue("Number of cylinders");
            tuner.Eng.Horsepower = InputUtilities.getIntegerInputValue("Horsepower");
            switch (InputUtilities.getStringInputValue("yes or no option for Has Nitrous"))
            {
            case ("yes"):
                tuner.Nitrous = true;
                break;

            case ("Yes"):
                tuner.Nitrous = true;
                break;

            case ("y"):
                tuner.Nitrous = true;
                break;

            case ("Y"):
                tuner.Nitrous = true;
                break;

            case ("YES"):
                tuner.Nitrous = true;
                break;

            default:
                tuner.Nitrous = false;
                break;
            }
        }