public void ShowVehicleQuastionsAndCheckAnswear(List <string> i_quastions, Owner_Details io_newOwner) // this function display the Vehicle questions and checks inputs { int numberOfQuestion = 1; // count the number of question bool isNotCorrectInput = true; // a boolean variable that checks whether the input from the user is correct string inputFormUser; foreach (string question in i_quastions) // For each question in the list of questions { while (isNotCorrectInput) // while the input isnt correct { try { isNotCorrectInput = true; Console.WriteLine(question); // display the question to user inputFormUser = Console.ReadLine(); io_newOwner.ownerVehicle.CheckVehicleInput(inputFormUser, numberOfQuestion); // send the input to a check function io_newOwner.ownerVehicle.UpdateVehicleInput(inputFormUser, numberOfQuestion); // updeate the vehicle details isNotCorrectInput = false; } catch (Exception wrrongLogicInput) { Console.WriteLine("Iligale input"); Console.WriteLine(wrrongLogicInput.Message); } } numberOfQuestion++; isNotCorrectInput = true; } }
public void ShowEngineQuastionsAndCheckAnswear(List <string> i_quastions, Owner_Details io_newOwner) // this function display the Engine questions and checks inputs { int numberOfQuestion = 1; // count the number of question bool isNotCorrectInput = true; // a boolean variable that checks whether the input from the user is correct string inputFormUser; foreach (string question in i_quastions) // For each question in the list of questions { while (isNotCorrectInput) // while the input isnt correct { try { isNotCorrectInput = true; Console.WriteLine(question); // display the question to user inputFormUser = Console.ReadLine(); io_newOwner.ownerVehicle.engine.CheckInputAndUpdateForEngine(inputFormUser, numberOfQuestion); // call to function that updeate the engine details and return an Ex if the input worng isNotCorrectInput = false; } catch (FormatException wrrongLogicInput) { Console.WriteLine("Iligale input"); Console.WriteLine(wrrongLogicInput.Message); } catch (ArgumentException wrrongLogicInput) { Console.WriteLine("Iligale input"); Console.WriteLine(wrrongLogicInput.Message); } } numberOfQuestion++; isNotCorrectInput = true; } }