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(); }
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(); }
//method to input Hot Rod information public static void CollectHotRodInformation(HotRod hot) { Console.WriteLine("\n"); ApplicationUtilities.DisplayDivider("Provide the information for the new Hot Rod"); Console.WriteLine(); hot.Name = InputUtilities.GetInput("Racer name"); hot.Speed = InputUtilities.getIntegerInputValue("Racer speed"); hot.Eng.Cylinders = InputUtilities.getIntegerInputValue("Number of cylinders"); hot.Eng.Horsepower = InputUtilities.getIntegerInputValue("Horsepower"); switch (InputUtilities.getStringInputValue("yes or no option for Has Blower")) { case ("yes"): hot.Blower = true; break; case ("Yes"): hot.Blower = true; break; case ("y"): hot.Blower = true; break; case ("Y"): hot.Blower = true; break; case ("YES"): hot.Blower = true; break; default: hot.Blower = false; break; } }