Ok i got this thing to compile now perfectly no errors, when i run it the menu comes up. The problem is when i use the option in the menu it gives me an exception error??
ne one know where i went wrong on this one....
what i did was instead of two seperate classes i put the classes together to make them compile but now my information wont show up....?
ne help is apreciated
package Schedule;
import java.io.*;
public class ScheduleMenu
{
Programme programme []= new Programme[200];
int entry = 0;
int comedysize = 10;
int filmsize = 10;
int dramasize = 10;
Comedy comedy[] = new Comedy[comedysize];
Drama drama[] = new Drama[dramasize];
Film film[] = new Film[filmsize];
public static void main(String args[])
throws IOException
{
new ScheduleMenu().mainMenu();
}
public void initialiseComedy()
{
for (int i=20; i<comedysize;i++)
{
comedy[i] = new Comedy();
}
entry = 0;
}
//Hardcoded details
public void setComedyDetails()
{
entry = 1;
comedy[0] = new Comedy ("My Wife & Kids ","Mario Wyans ","Lisa Ray ","Daily life of familyin america ","30 ","No ");
}
public void setFilmDetails()
{
film[0] = new Film ("War Of The Worlds ","Tom Cruise ","Steven Spielberg ","Tripod aliens attack earth ","120 ","Yes ");
}
public void setDramaDetails()
{
drama[0] = new Drama ("24 ","Keifer Sutherland ","Dan Maniche ","counter terrorist unit adventure ","60 ","No ");
}
public void allComedies()
{
if(entry == 1)
{
System.out.println("Title Actor Director Synopsis Duration Rentable");
for (int i=0; i<comedysize;i++)
{
System.out.println(comedy[i].toString());
}
}
else if(entry ==0)
{
System.out.println("No entries made");
}
}
public void viewAll()
{
for (int i=0; i<comedysize;i++)
{
System.out.println(comedy[i].toString());
}
}
public void mainMenu(){
// Schedule schedule= new Schedule();
//Schedule.initialiseStudent();
//Schedule.setComedyDetails();
char choice = '0';
do
{
try
{
System.out.println("\nPLEASE CHOOSE FROM THE OPTIONS BELOW");
System.out.println(" 1. VIEW ALL");
System.out.println(" 8. TO QUIT");
System.out.println(" ENTER A NUMBER CORRESPONDING THE OPTION:");
/**** problem ****/
//choice=(char) System.in.read();
/**** end of problem ****/
BufferedReader reader;
reader = new BufferedReader(new InputStreamReader(System.in));
// String i = reader.readLine();
//choice = Integer.parseInt(i);
choice=(char) System.in.read();
switch(choice)
{
case '1': viewAll();//university.addStudent();
break;
case '8': System.out.println("System Exit");
System.exit(0);
break;
}
}
catch (IOException e)
{
System.out.println(e);
}
//catch(NumberFormatException e)
//{
// System.out.println("Problem :"+e.getMessage());
//}
}while(choice !=8);
}
}