import java.util.Scanner;

public class LazyDays
{
	public static void main (String[] args)
	{
	
	Scanner scan = new Scanner();
	
	int temp;
	
	System.out.println ("What is the current temperature?");
	temp = scan.nextInt();
	
	
		if (temp < 20)
			{
			if (temp > 95)
				{
				System.out.println("Go visit our shops!");
				}
			} 
		if (temp >= 80)
			{
			System.out.println("Go swimming!");
			}
		if (60 <= temp)
			{
			if (80 < temp)
				{
				System.out.println("Go play tennis!");
				}
			}
		if (40 <= temp)
			{
				if (temp < 60)
				{
				System.out.println("Go play golf!");
				}
			}
		if (temp < 40)
			{
			System.out.println("Go skiing!");
			}	
	}
}

Assignment says we must use cascading if statements, which is why I use them. I keep getting this error:

LazyDays.java:8: cannot find symbol
symbol  : constructor Scanner()
location: class java.util.Scanner
	Scanner scan = new Scanner();
				   ^
Re: Simple "if" statement problem..compiling error 80 80

Try changing line 8 to:

Scanner scan = new Scanner(System.in);
commented: thanks! +0
Re: Simple "if" statement problem..compiling error 80 80

Also had to make some logical improvements after correcting. Thank you!!!

import java.util.Scanner;

public class LazyDays
{
	public static void main (String[] args)
	{
	
	Scanner scan = new Scanner(System.in);
	
	int temp;
	
	System.out.println ("What is the current temperature?");
	temp = scan.nextInt();
	
	
		if (temp < 20)
			{
			System.out.println("Go visit our shops!");
			}
		if (temp > 95)
			{
			System.out.println("Go visit our shops!");
			}
		if (temp >= 80)
			{
			System.out.println("Go swimming!");
			}
		if (temp >= 60)
			{
			if (temp < 80)
				{
				System.out.println("Go play tennis!");
				}
			}
		if (temp >= 40)
			{
				if (temp < 60)
				{
				System.out.println("Go play golf!");
				}
			}
		if (temp < 40)
			{
			System.out.println("Go skiing!");
			}	
	}
}
Re: Simple "if" statement problem..compiling error 80 80

Glad to help. Please mark the thread solved if you have no further questions. Thanks.

Re: Simple "if" statement problem..compiling error 80 80

Just add [Solved] to the thread title? Or is there another option?

Re: Simple "if" statement problem..compiling error 80 80

Scroll to the bottom of the page and click the link that says Mark As Solved (or something like that)
It will be after the last post. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.