Cinema booking system
Hi there,
I have a little problem with java,
I can't find my mistakes if someone can help me to complete it,
I should submit my work on Monday before 16h
here is what i've done so far but doesn't want to compile:
I have a little problem with java,
I can't find my mistakes if someone can help me to complete it,
I should submit my work on Monday before 16h
here is what i've done so far but doesn't want to compile:
Movie title string screen string showtime string Listmoviz= new ArrayList (); Movie m1= new Movie ("Men In Black", "Screen 10", "13h30,16h00,19h30" ); Movie m2= new Movie ("Matrixx", "Screen 11", "14h30, 16h30,18h30" ); Movie m3= new Movie ("Devdas", "Screen 12", "15h30, 18h00, 20h00" ); Movie m4= new Movie ("Source Code", "Screen 13", "13h30, 15h30, 17h00" ); Movie m5= new Movie ("Limitless", "Screen 14", "12h30, 15h00, 17h30" ); moviz.add(m1); moviz.add(m2); moviz.add(m3); moviz.add(m4); moviz.add(m5); System.out.println(Movie); // implicity call toString method of List public String toString() { return "(" + title +", "+ screen", "+ "showtime +")\n"; } -------------------------------------------------------------------------------------- Class Cinema { private String film; private STring screener; private String showFilm; public Cinema (String filmIn, String screenerIn, String showFilmIn); { film= filmIn; screener= screenerIn; showFilm= showFilmIn; } public String getFilm() { return film; } public String getScreener() { return screener; } public String getShowFilm() { return showFilm; } } -------------------------------------------------------------------------------------------- import java.util.*; import java.io.*; public class MovieFileTester { public static void main (String [] args) { char choice; List moviz= new ArrayList (); readList(moviz); do { System.out.println("\nCinema Tester"); System.out.println("1. Add movie/seat"); System.out.println("2. Remove movie/seat"); System.out.println("3. List all movies"); System.out.println("4. Quit\n"); choice= EasyScanner.nextChar(); System.out.println(); switch (choice) { case '1' : addMovie(moviz); break; case '2' : removeMovie (moviz); break; case '3' : listAll (moviz); break; case '4' : System.out.print ("\nPlease choose a number form 1 - 4 only \n" ); } }while (choice !='4'); } private static void addMovie (List movieListIn) { String tempMov; String tempScre; String tempSho; System.out.print("Please enter Movie title: "); tempMov= EasyScanner.nextString(); System.out.print("Please enter Screen number: "); tempScre= EasyScanner.nextString(); System.out.print("Please enter ShowTime: "); tempSho= EasyScanner.nextString(); movieListIn.add(new Movie (tempMov, tempScre, tempSho)); } private static void removeMovie(List movieListIn) { int pos; System.out.print ("Enter position of the movie to be remove: "); pos= EasyScanner.nextInt(); movieListIn.remove(pos - 1); } private static void listAll(List movieListIn) { for (Movie item : movieListIn) System.out.println(item.getFilm() + "" + item.getScreener() + "" + item.getShowFilm()); } } private static void writerList(List movieListIn) { try { FileWriter movieFile = new FileWriter("MyShow.txt"); PrintWriter movieWriter = new PrintWriter (movileFile); for (Movie Item : movieListIn) { movieWriter.println(item.getFilm()); movieWriter.println(item.getScreener()); movieWriter.println(item.getShowFilm()); } movieWriter.close(); } catch(IOException e) { System.out.println("There was a problem writing the file"); } } private static void readList(List movieListIn) { String tempMov; String tempScre; String tempSho; try { FileReader movieFile = new FileReader ("MyShow.txt"); BufferedReader movieStream = new BufferedReader(movieFile); tempMov=movieStream.readLine(); while (tempMov != null) { tempScre= movieStream.readLine(); tempSho= movieStream.readLine(); movieListIn.add(new Movie (tempMov, tempScre, tempSho)); tempMov = movieStream.readLine(); } movieStream.close(); } catch (FileNotFoundException e) { System.out.println("\nNo file was Read"); } catch (IOException e) { System.out.println("\nThere was a problem reading the file"); } } }
Replies
You are reading an archived discussion.
Related Posts
Here is a demonstration of Standard Penetration Test.
[video=youtube;jo64QIE4hr4]https://www.youtube.com/watch?v=jo64QIE4hr4&feature=player_embedded[/video]
Hello friend's
I want to do SCJP sun microsoft certification in this summer.Anybody have idea how to apply for sun microsoft certification online ?
I have here some questions about Fibre Reinforced Concrete and I hope civil Ceans will answer these.😀😒
1.What is a Fibre Reinforced Concrete???
2. What are the effect of fibre...
Here is a video about Green Concrete.😁
[video=youtube;910scqpLHIE]https://www.youtube.com/watch?v=910scqpLHIE&feature=player_embedded#at=20[/video]
Hi friends,
As we all study the subjects in the college and we also face the viva at the submission time so how if we start the Exams here on...