Hello everyone. I'm currently having a problem with choosing one area in an array. For what I'm working on I'm trying to pick one seat in an array consisting of 10 seats. The first 5 seats are firstclass and the last 5 seats are economy. For example if the person picks firstclass they should be issued one seat out of the five but my program keeps selecting 5 seats. Here is an example of what I'm doing.
import java.util.Scanner;
public class Flight
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int sectionnumber;
String selectionletter;
int seats[] = new int[9];
System.out.println ("*************** Airline Reservation System ****************");
System.out.println ("Please type 1 for First Class or 2 for Economy");
sectionnumber = input.nextInt();
// Lets user select first class or economy
if (sectionnumber == 1)
{
for (int firstclass = 1; firstclass < 6; firstclass++)
{
System.out.println("Your seat number is: " + firstclass);
}
}
if (sectionnumber ==2)
{
for (int economy = 6; economy < 11; economy++)
{
System.out.println("Your seat number is: " + economy);
}
}