[SOLVED] Help with if...else...
This program has been driving me nuts. I cannot get a clean compile. The more I look at, the more I just want to completely forget about it. Could someone take a look at it and see if you notice anything wrong?
Code:
import java.io.*;
public class ifExample {
public static void main (String Args[]) throws IOException {
String day;
String name = ("Jamie Ambrose");
String monday = ("\n --Monday Schedule-- \n MA103 11:00am - 12:15pm \n PS101 2:00pm - 3:15pm");
String tuesday = ("\n --Tuesday Schedule-- \n CIS106 2:00pm - 3:15pm \n PC103 5:00pm - 7:15pm");
String wenesday = ("\n --Wednesday Schedule--\n MA103 11:00am - 12:15pm \n PS101 2:00pm - 3:15pm");
String thursday = ("\n --Thursday Schedule--\n CIS106 2:00pm - 3:15pm");
String friday = ("\n No class today");
try {
BufferedReader bf = BufferedReader (new InputStreamReader(System.in));
System.out.println("Enter the day of week you would like to view: \n Monday-1 \n Tuesday-2 \n Wednesday \n Tursday-3 \n Friday-4");
day = bf.readLine();
int daynum = Integer.parseInt(day);
}
catch (IOException ioe) {
System.out.println("IO exception Occurred");
}
if ( daynum == 1)
{
System.out.println(name + "Todays Scheudle" + 1);
}
else if ( daynum == 2)
{
System.out.println(name + "Todays Schedule" + 2);
}
else if (daynum == 3)
{
System.out.println(name + "Todays Schedule" + 3);
}
else if (daynum == 4)
{
System.out.println(name + "Todays Schedule" + 4);
}
else if (daynum == 5)
{
System.out.println(name + "Todays Schedule" + 5);
}
else {
System.out.println("Enter valid number");
}
}
}
and the errors:
Code:
G:\Spring 08\CIS 106\ifExample.java:21: cannot find symbol
symbol : method BufferedReader(java.io.InputStreamReader)
location: class ifExample
BufferedReader bf = BufferedReader (new InputStreamReader(System.in));
^
G:\Spring 08\CIS 106\ifExample.java:33: cannot find symbol
symbol : variable daynum
location: class ifExample
if ( daynum == 1)
^
G:\Spring 08\CIS 106\ifExample.java:38: cannot find symbol
symbol : variable daynum
location: class ifExample
else if ( daynum == 2)
^
G:\Spring 08\CIS 106\ifExample.java:42: cannot find symbol
symbol : variable daynum
location: class ifExample
else if (daynum == 3)
^
G:\Spring 08\CIS 106\ifExample.java:47: cannot find symbol
symbol : variable daynum
location: class ifExample
else if (daynum == 4)
^
G:\Spring 08\CIS 106\ifExample.java:52: cannot find symbol
symbol : variable daynum
location: class ifExample
else if (daynum == 5)
^
6 errors