In this following main method I am trying to code so if the user does not input the proper response, then the code will loop until the user does provide the correct response.
I know I'm off center here, but I'm drawing a blank of how to correct this.
Please keep in mind I'm tying to keep this simple and basic.
public static void Main()
{
string name = "";
float startBal = 0;
int acctNum = 0;
string userInput = "";
float[] deposits = new float[30];
float[] withdrawls = new float[30];
DisplayIntroduction();
name = GetName();
startBal = GetStartBal();
acctNum = CreateAccount();
Console.WriteLine("\n{0}, here is your new account # {1}\n", name, acctNum);
do
{
Console.Write("Enter a 'D' to Deposit, 'W' to Withdrawl, or 'X' to End the program: ");
userInput = Convert.ToString(Console.ReadLine());
if (userInput.ToUpper() == "D")
{
//do the deposit, modify the deposit array
Console.WriteLine("You entered D");
}
else if (userInput.ToUpper() == "W")
{
//do the withdrawl, modify the withdrawl array
Console.WriteLine("You entered W");
}
else if (userInput.ToUpper() == "X")
{
//end the program, clear screen and display the summary
Console.WriteLine("You entered X");
}
else
{
Console.WriteLine("Please enter a valid option:");
}
} while (userInput.ToUpper != "D" || userInput.ToUpper != "W" || userInput.ToUpper != "X");
}