/* Lab 3, problem 2: a complete solution -- verson 2.*/ import java.util.Scanner; class AdvisorComplete2 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print ("Enter outside temperature: "); int temp = scan.nextInt(); scan.nextLine(); // must be present to correctly accept // the next String input String reply; System.out.print ("Is it raining outside? (yes/no) "); reply = scan.nextLine(); // case 1: the outside temperature is less than 60 if (temp <= 60) { if (reply.equals("yes")){ System.out.print ("Wear a raincoat."); System.out.println (".. and don't forget an umbrella."); } else System.out.println ("Wear an overcoat."); } else { if (temp < 70) { System.out.print ("Wear a jacket."); if (reply.equals("yes")) System.out.println (".. and don't forget an umbrella."); } else if (reply.equals("yes")) System.out.println ("Get an umbrella."); else System.out.println ("Perfect weather -- nothing to worry about."); } } }