Commit f85e03bc authored by alexandru.radulesc's avatar alexandru.radulesc

Added an attempt of looping doesn't work

parent 942b82f1
......@@ -3,7 +3,6 @@ import java.util.Scanner;
public class Yeyey1 {
//--------------------------------------------------Setup Phase--------------------------------------------------\\
static Scanner input = new Scanner(System.in); //We're just setting up the input for now;
static String[] seat = new String[100];
static int j=0,k=0,mainSeatNumber=0,classRead;
......@@ -23,6 +22,9 @@ public class Yeyey1 {
}
ShowSeats();
while(classRead!=4)
{
System.out.println("For First Class please input 1");
System.out.println("For Business Class please input 2");
......@@ -32,6 +34,7 @@ public class Yeyey1 {
BookSeats(classRead);
ShowSeats();
}
}
......@@ -42,24 +45,21 @@ public class Yeyey1 {
{
System.out.println("Please select a seat from 01 to 18");
{
mainSeatNumber = input.nextInt();
seat[mainSeatNumber - 1] = "XX";
OccupySeats();
}
}
else if(mainClass == 2)
{
System.out.println("Please select a seat from 19 to 45");
{
mainSeatNumber = input.nextInt();
seat[mainSeatNumber - 1] = "XX";
OccupySeats();
}
}
else if(mainClass == 3)
{
System.out.println("Please select a seat from 46 to 90");
{
mainSeatNumber = input.nextInt();
seat[mainSeatNumber - 1] = "XX";
OccupySeats();
}
}
}
......@@ -113,5 +113,14 @@ public class Yeyey1 {
AssignSeats(45,90);
}
public static void OccupySeats()
{
mainSeatNumber = input.nextInt();
if(seat[mainSeatNumber] !="XX")
{
seat[mainSeatNumber - 1] = "XX";
}else System.out.println("Seat is already occupied");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment