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();
				   ^

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!");
			}	
	}
}

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

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.

Edited 7 Years Ago by Grn Xtrm: n/a

This question has already been answered. Start a new discussion instead.