public class StateA { public static void main (String[]args) { String input;
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter one of the following state abbreviations: "); System.out.println("NC, SC, GA, FL, or AL"); input = keyboard.nextLine();
if (input.equalsIgnoreCase("NC")) { System.out.println("You've entered the abbreviation for North Carolina"); } else if (input.equalsIgnoreCase("SC")) { System.out.println("You've entered the abbreviation for South Carolina"); } else if (input.equalsIgnoreCase("GA")) { System.out.println("You've entered the abbreviation for Georgia"); } else if (input.equalsIgnoreCase("FL")) { System.out.println("You've entered the abbreviation for Florida"); } else if (input.equalsIgnoreCase("AL")) { System.out.println("You've entered the abbreviation for AlabamaA"); } else { System.out.println("That's not a choice."); } } }
Also, when you make a UML diagram, do you do it for the class or demo - or both?
public class StateAbbreviationsDemo { public static void main(String[]args) { String yourinput;
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter one of the following state abbreviations: "); System.out.println("NC,SC, GA, FL, or AL"); yourinput = keyboard.nextLine();
StateAbbreviations states = new StateAbbreviations(yourinput);
System.out.println("You have entered the abbreviation for " + states.getSOMETHING); } }