Hello,
I am working on this java project for my homework for a beginner java class. I have it all done, with one issue. When the user inputs an invalid entry instead of just looping back up and starting over it goes down to the "Enter degrees in Fahrenheit" section. I am sure it is a simple fix. Can anyone help me with this issue? I have attached my code. Thank you for the help
//Brett Olsen, Assignment 3, Temperature Converter //13 July 2014 CMIS 141 import java.util.Scanner; //Welcome Screen public class TemperatureConverter { public static void main(String[] args){ System.out.print("Welcome to THE TEMPERATURE CONVERTER"); temperatureConverter(); } public static void temperatureConverter(){ Scanner user_input = new Scanner(System.in); char selection; //Menu do { System.out.println("\n"); System.out.println("F/f\tfrom Fahrenheit to Celsius"); System.out.println("C/c\tfrom Celcius to Fahrenheit"); System.out.println("E/e\tQuit"); System.out.println("\nYour Option: "); selection = user_input.next().charAt(0); selection = Character.toUpperCase(selection); //Invalid responses boolean invalid = ((selection != 'F' && selection != 'C' && selection != 'E')); if (invalid) System.out.print("Invalid Selection"); //Selection to convert Fahrenheit to Celcius if (selection !='C' && selection !='E') { System.out.println("Enter a degree in Fahrenheit: "); double fahrenheit = user_input.nextDouble(); System.out.println(fahrenheit + " Fahrenheit is " + ((fahrenheit -32)*(5/9.0)) + " celsius."); //Selection to convert Celcius to Fahrenheit } else if (selection!='F' && selection !='E') { System.out.println("Enter a degree in Celcius: "); double celcius = user_input.nextDouble(); System.out.println(celcius + " Celcius is " + ((celcius * 9/5) + 32) + " Fahrenheit."); //Selection to Quit program } else if (selection !='F' && selection !='C') { System.out.println("Thank you have a great day!"); } } while (selection != 'E' && selection != 'e'); } }