0

I don't know why it doesn't compile ! !

import java.util.Scanner;

public class Beach {

	public static void main (String [] args) {
		
		Scanner input = new Scanner (System.in);
		
		System.out.println("Enter the weather Hot or Cold");
		
		String A;
	
		A = input.next();
		
		System.out.println("Enter the type of day Sunny or Windy or Rainy");
		
		String B;
		B = input.next();
		
		
		if(A.contains("Hot"))
		{
		
		    if(B.contains("Rainy"))
			{
			System.out.print("Don't go to Melbourne Beach");
			}
                
			else
			{
			System.out.print("Go to Melbourne Beach");
			}
		 
		 if(A.contains("Cold"))
		 {
		 
		 
			if(B.contains("Windy"))
			{
			System.out.print("Don't go to Melbourne Beach");
			}
			
			else
			{
			System.out.print("Go to Melbourne Beach");
        }
	}
}
4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by Philippe.Lahaie
0

because you don't have enough closing brackets ( } ) at the end of your class.
you're missing two.

add them, and it 'll work, but maybe they won't be on the right spot, didn't check for that.

0

If it doesn't compile, there will be error messages.
WE don't know why it doesn't compile either.
Maybe you should tells US.
THEN we can give you a hand.

0

there is one closing bracket missing just before "if(A.contains("Cold"))" to close the "if(A.contains("Hot"))" , and another closing bracket missing at the end to close the class

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.