this is my final project for my java class. This is what im supposed to do:::::

Write a program that can be used for reserving airline seats. You can use three algorithm building blocks (Sequence, Selection, and Iteration). The airline has 15 rows, with 6 seats in each row. Rows 1 to 6 are business class, and rows 7 to 15 are economy class. " x" indicates that the seat has been reserved; "- " indicates that the seat is available. Allow the user to enter the ticket type, desired row number, desired seat number, and etc. It should then display seat availability.

Your program prompts the user to enter the following information:

INPUT:
a. Ticket type: business class ; economy class
b. Desired row number for busienss class (1-6); economy class(7-15)
c. Desired seat number (A - F):

This is what i have so far

//PJ Eady
//Final project
// write a program that displays seat availability based on the user input

public class AirlineSeats
{
    public static void main(String[] args)
    {
            //initialize and declare variables, seats and matirx
            boolean[][] seats= new boolean [15][6];

            //create method calls and display blank seat chart
            initializeSeatChart(seats);
            displaySeatCharts(seats);

            //create a scanner object
            Scanner keyboard =new Scanner(System.in);

            while(availableSeats(seats)
            {
                //create method calls
                assignSeatType(seats);
                int seatNumber = seatSelection(seats);

                System.out.print("Do You want to receive another seat? " );
                //statements

        //if Yes print out the available seats s, otherwise exit the program
                // if ----- else statement      
            }
        }

//create a method that represents open seats
public static void initializeSeatChart(booleab[][] seatPlan)
    {
    //the nested loop that follows prints out the empty seat
        for(int i = 0; i<seatPlan.length; i++)
            for(int j = 0; j<seatPlan[0].length; j++)
            seatPlan[i][j] = '-';


    }

//create a method that display the seating chart and able to see the seats occupied or not
        public static void DisplaySeatChart(boolean[] [] seatPlan)
        {
            //set up to 6 columns
            System.out.println("\t A B C\t D E F");
            //the nested loop that follows prints out the row number
            //and then check if each seat is occupied

            for()
            {

                //statements
                for()

                //statements
            }

        }

        //create a method and check if there is still a seat available
        public static boolean avalableSeat(boolean [][] seatPlan)
        {
            //the nested for loop searches for any empty seat

            //if it finds, it will stop and return true
            //statements

            return false;
        }

        //create a method that assign seat type and select the row numbers based on the user input
        public static void assignSeatType(boolean [] [] seatPlan)
        {
                //prompts the user for entering the ticket type

                //use switch statement: case 1 for business class and case 2 for economy class
                switch(ticketType)
                {
                    //enter the row number(1 to 6)
                    case 1:
                            if
                            else
                            break;


                    //enter the row number(7 - 15)
                    case 2:
                            if 
                            else 
                            break;
                }

            }


            //create a method that select the seat number (A-F) based on the user input
            public static int seatSelection()
            {

                //create a scanner object that will scan for the seat

                //prompts the user for a seat number

                //hold the string value entered and takes the first character

                //checks to see if it is within range of A(65) and F(70)

                //return te letter minus 65, which will bring it to a range of 0-5

            }
    }

Im complety at a loss with arrays. the parts that are commented out are the parts i cant figure out. If anyone can help ill be your best friend.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.