Commit 4be0feaf authored by alexandru.radulesc's avatar alexandru.radulesc

Simplified code

parent 79ef8741
......@@ -3,87 +3,51 @@ import java.util.Scanner;
public class Yeyey1 {
//--------------------------------------------------Setup Phase--------------------------------------------------\\
Scanner input = new Scanner(System.in); //We're just setting up the input for now;
static int[] seat = new int[100];
static int j=0,k=0;
public static void main(String[] args) {
int[] seat = new int[100];
int j=0,k=0;
// TODO Auto-generated method stub
//--------------------------------------------------Setup Phase--------------------------------------------------\\
// TODO Auto-generated method stub
System.out.println("");
System.out.println("---------------FIRST CLASS----------------");
System.out.println("");
//--------------------------------------------------Actual Code Phase--------------------------------------------------\\
for(int i = 0;i<18;i++)
{
seat[i] = i+1;
if(k<9)
{
if(j<3)
{
if(i<9) System.out.print("[0" + seat[i] + "]");
else System.out.print("[" + seat[i] + "]");
j++;
}
if(j==3)
{
System.out.print(" ");
j=0;
}
k++;
}
if(k==9)
{
System.out.println("");
k=0;
}
}
ShowSeats(0,18);
System.out.println("");
System.out.println("--------------BUSINESS CLASS--------------");
System.out.println("");
for(int i = 18;i<45;i++)
{
seat[i] = i+1;
if(k<9)
{
if(j<3)
{
System.out.print("[" + seat[i] + "]");
j++;
}
if(j==3)
{
System.out.print(" ");
j=0;
}
k++;
}
if(k==9)
{
System.out.println("");
k=0;
}
}
ShowSeats(18,45);
System.out.println("");
System.out.println("--------------ECONOMY CLASS--------------");
System.out.println("---------------ECONOMY CLASS--------------");
System.out.println("");
for(int i = 45;i<90;i++)
ShowSeats(45,90);
}
public static void BookSeats(int classNum) //Method for adding the seats and displaying them
{
}
public static void ShowSeats(int start, int finish)
{
for(int i = start;i<finish;i++)
{
seat[i] = i+1;
if(k<9)
{
if(j<3)
{
System.out.print("[" + seat[i] + "]");
if(i<9) System.out.print("[0" + seat[i] + "]");
else System.out.print("[" + seat[i] + "]");
j++;
}
if(j==3)
......@@ -101,12 +65,6 @@ public class Yeyey1 {
}
}
}
public void BookSeats(int classNum) //Method for adding the seats and displaying them
{
}
}
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