Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.35 KB | None | 0 0
  1. package helpFiles;
  2. import java.io.File;
  3. import java.util.Scanner;
  4. import java.io.FileReader;
  5. import java.io.PrintWriter;
  6. import java.io.FileNotFoundException;
  7.  
  8. public class SeatDiscountSystem2 {
  9.  
  10.  
  11.     public static void main(String[] args) throws Exception{
  12.         int option;
  13.         try {
  14.             File Seats = new File("seats.txt");
  15.             Scanner mySeatReader = new Scanner(Seats);
  16.             while (mySeatReader.hasNextLine()) {
  17.                 String seatValues = mySeatReader.nextLine();
  18.                 System.out.println(seatValues);
  19.             }
  20.             mySeatReader.close();
  21.         } catch (FileNotFoundException e) {
  22.             System.out.println("An error occured");
  23.             e.printStackTrace();
  24.         }
  25.        
  26.         Scanner answer = new Scanner(System.in);
  27.         do {
  28.             do {
  29.                 String menu = "\n - - Seat Booking System - - "
  30.                         + "\n - - Main Menu - -"
  31.                         + "\n 1 - Reserve Seat "
  32.                         + "\n 2 - Cancel Seat "
  33.                         + "\n 3 - View Seat Reservations "
  34.                         + "\n 0 - Quit "
  35.                         + "What is your choice? : ";
  36.                 System.out.println(menu);
  37.                 option = answer.nextInt();
  38.             } while(option < 0 || option  > 4);
  39.            
  40.             switch(option) {
  41.                 case 1:
  42.                     System.out.println("Reserve Seat");
  43.                     break;
  44.                 case 2:
  45.                     System.out.println("Cancel Seat");
  46.                     break;
  47.                 case 3:
  48.                     System.out.println("View Seat Reservations");
  49.                     break;
  50.                 }
  51.         }while (option != 0);
  52.        
  53.        
  54.        
  55.        
  56.     }
  57.        
  58.        
  59.        
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement