0

I am having trouble getting started with my program. I have writen the array but I am having trouble starting the if statemnent to fill the seats in the program. If they press 1 it needs to fill seats 1 through 5 if they press 2 it needs to fill seats 6 through 9. it cannot fill the same seat twice and if one section is filled it needs to go to the next. Any help would be appreciated.

public class
{
    final static int QUIT = 3
    static Scanner console = new Scanner(System.in);
    public static void main(String[] args)
    {
        boolean[] seats = new Boolean[10];

        seats[0] = false;
        seats[1] = false;
        seats[2] = false;
        seats[3] = false;
        seats[4] = false;
        seats[5] = false;
        seats[6] = false;
        seats[7] = false;
        seats[8] = false;
        seats[9] = false;

        int firstClass;
        int economy;
        int seating;

        System.out.println("If you would like first class press 1, if you would like economy press 2 or press 3 to 
        quit.");
        seating = console.nextInt();

        while(!QUIT)
        {
            if
2
Contributors
1
Reply
25
Views
4 Years
Discussion Span
Last Post by JamesCherrill
1

Try writing down the logic in simple english before trying to do it in Java. Imagine you are explaining to someone else how the allocation should be done if it was a manual/paper system.
This will help you get the logic clear in your own head, after which the Java will be easy.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.