Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Flight Reservation Write a program for small Flight Reservation System with foll

ID: 3560180 • Letter: F

Question

   Flight Reservation

Write a program for small Flight Reservation System with following Details

Show Menu with Following options

1 Flight Reservation

2 Boarding pass

3 Exit Menu

Flight Reservation : In this option reserve seats for a passanger based on class selected .

Fight seats are divided into two classes

1 Business class (1 to 5)

2. Economy class (6 to 10)

Use single dimension array of size 10 to store seat no . Initially all elemnts will be 0 , after reservation assign a seat number as mentioned above .

To book a seat you have to input passanger number and class(1 for business and 2 for economy) based on class you will check if seat for particular class is available or not (remember initially all seats are 0 and when booked a number will be assigned )

Store passanger number and seat number in 2d array .

In program you will design a menu in main method and input passenger number and class type(1 for Business or 2 for economy) from user. Call a seperate method reservation() and pass class type(1 or 2) as a parameter .

reservation() method will check availability of seat based on class. If seat is available assign a seat number and also return seat number to main method so that seat number can be stored in 2D array with passanger number.

If seat is not available in a particular class or if all seats are full. Display appropriate message on such conditions.

Boarding Pass: This option should display all passanger number with seat number from 2d array . Also Print class (Business or Economy) based on seat number .

Validations To perform:

1) Display appropriate mesage if seat is not available in a particular class

2) Display a seperate message if all seats are full

3) pasaanger number should be a unique number (should not already exist in 2d array )

Seat Numbers : 1 to 5 for Business Class and 6 to 10 for Economy Class

( you can select different number range for seats , Logic here is half seats belongs to business class and half belongs to economy class)

Suggestions :  

System.exit(0); statement can be used to exit from program

System.out.print('u000C'); statement can be used to clear screen

Expectations:

1) single dimension(10 elements) array to store seat numbers

2) 2D array(10*2 elements) to to store passanger numbers and allocated seat numbers

3) seperate method(other than main method ) to reserve seats

4) validations (mentioned above)

5) Display Boarding Pass should print all passanger numbers, seat numbers assigned(from 2D array) and Class type (Business or Economy)

6) Use java doc comments to describe class, methods and use inline comments to explain logic inside methods.

7) Two arrays (one single dimension, one 2d array) are must to implement in this program.

Explanation / Answer

import java.io.*;      import java.util.*;      import java.lang.*;                  public class boardingPassStep{                public static void main(String[] arguments) {                     String[] booking = new String[9];            String getUserInput;      String getUserInput(){   InputStreamReader input = new InputStreamReader(System.in);   BufferedReader stream = new BufferedReader( input );   String answer = new String();       try{   answer = stream.readLine();   }   catch (java.io.IOException e){   return answer;   }   return answer;   }             void StartOut(){            System.out.println("Please type 1 for 'smoking' section or 2 for 'non-smoking' section. Press 'enter' when done.");         getUserInput();      void Smoking(){   System.out.println("Boarding Pass: Smoking Seat:" + s);   System.out.println("Would you like to book another seat? [y/n]. Press 'enter' when done.");   }      void NonSmoking(){   System.out.println("Boarding Pass: Non-Smoking Seat:" + s);   System.out.println("Would you like to book another seat? [y/n]. Press 'enter' when done.");   }                           for(i = 0; i