title: Simple Cinema Booking System
body: <p>I'm doing a simple cinema booking system. Here's the code that I've done so far. I'm a beginner and I'm pretty sure there are some flaws or bad coding practices in my code so please pardon me and correct me if you would like to. </p>
  
  <p>I wanna ask that how can I modify the booked seats from integer to "**" and display it on the seating plan when the second loop of the whole program is executed so that the customers are able to see which seats have been booked? For example, a customer has booked seat 5, and he/she wants to book more, so when the second loop comes, he/she is able to see seat 5 has become **, which means it has been booked. I want to do this using array since I'm learning it, but I appreciate too if you have other methods than using array.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class CinemaBooking {
  
    public static void main(String[] args) {
  
      Scanner input = new Scanner(System.in);
  
      int[] SeatNo = new int[30];
      int Seats;
      int YesOrNo = 1;
      String CustomerName;
  
      while (YesOrNo == 1) {
        System.out.print("Welcome to Crazy Cinema!\nWhat is your name?\n");
        CustomerName = input.nextLine();
  
        System.out.printf("Welcome %s! Please have a look at the seating plan.\n\n", CustomerName);
  
        for (int i = 1; i &lt;= 34; i++) {
          System.out.print("*");
        }
        System.out.println();
  
        System.out.print("      CINEMA 1 SEATING PLAN");
        System.out.println();
  
        for (int j = 1; j &lt;= 34; j++) {
          System.out.print("*");
        }
        System.out.println();
  
        for (int SeatCounter = 0; SeatCounter &lt; SeatNo.length; SeatCounter++) {
          System.out.printf(SeatCounter + "\t");
  
          if (SeatCounter == 4) {
            System.out.println();
          } else if (SeatCounter == 9) {
            System.out.println();
          } else if (SeatCounter == 14) {
            System.out.println();
          } else if (SeatCounter == 19) {
            System.out.println();
          } else if (SeatCounter == 24) {
            System.out.println();
          } else if (SeatCounter == 29) {
            System.out.println();
          }
        }
        for (int k = 1; k &lt;= 34; k++) {
          System.out.print("*");
        }
        System.out.println();
  
        System.out.print("Which seat would you like to book? ");
        Seats = input.nextInt();
  
        while (Seats &lt; 0 || Seats &gt; 29) {
          System.out.println("Only 0 - 29 seats are allowed to book. Please try again: ");
          Seats = input.nextInt();
        }
  
        for (int SeatCounter = 0; SeatCounter &lt; SeatNo.length; SeatCounter++) {
          if (SeatCounter == Seats) {
            System.out.println("Seat " + Seats + " is successfully booked.");
            System.out.println(
                "Thanks for booking!\n\nWould you like to make next booking? (Type 1 = Yes; Type 2 = No)");
            YesOrNo = input.nextInt();
  
            if (YesOrNo == 2) {
              System.out.println("Thank you for using this program.");
            }
          }
        }
  
        while (YesOrNo != 1 &amp;&amp; YesOrNo != 2) {
          System.out.println("Invalid input.");
          System.out.println("Type 1 = Continue booking; Type 2 = Exit the program");
          YesOrNo = input.nextInt();
  
          if (YesOrNo == 2) {
            System.out.println("Thank you for using this program.");
          }
        }
      }
    }
  }
  </code></pre>