Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.28 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package cinemare;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author Mohd Alif Nizam
  13. */
  14. public class CinemaRe {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. public static void main(String[] args) {
  20. // TODO code application logic here
  21. Scanner ind = new Scanner(System.in);
  22. int no_tic, ch1;
  23. String[] seat = new String[30];
  24. int[] seat_no = new int[30];
  25.  
  26. for (int i = 0; i < 30; i++) {
  27. seat[i] = "[" + i + "]";
  28. }
  29. int no_tic1;
  30. String[] seat1 = new String[30];
  31. int[] seat_no1 = new int[30];
  32.  
  33. for (int i = 0; i < 30; i++) {
  34. seat1[i] = "[" + i + "]";
  35. }
  36.  
  37. while (true) {
  38. System.out.println("\n************WELCOME TO GSC TERENGGANU ONLINE BOOKING***************");
  39. System.out.println("\n** 1.FROZEN 2 2.EJEN ALI**");
  40. System.out.println("\n***********************SELECT YOUR MOVIE***************************");
  41. ch1 = ind.nextInt();
  42. switch (ch1) {
  43. case 1:
  44. output_Booking("FROZEN 2 MOVIE BOOKING", 2);
  45. ch1 = ind.nextInt();
  46. switch (ch1) {
  47. case 1:
  48. int index;
  49. System.out.print("\n NO. OF TICKETS:");
  50. no_tic = ind.nextInt();
  51.  
  52. for (int i = 0; i < 30; i++) {
  53. if ((i == 10) || (i == 20) || (i == 30)) {
  54. System.out.println("\n");
  55. }
  56. System.out.print(seat[i]);
  57. }
  58. System.out.println("\n**SELECT YOUR SEAT**");
  59. for (int i = 0; i < no_tic; i++) {
  60. seat_no[i] = ind.nextInt();
  61. index = seat_no[i];
  62. seat[index] = "x";
  63. }
  64. output_TicketHeader("FROZEN 2 MOVIE");
  65. for (int i = 0; i < no_tic; i++) {
  66. System.out.println("** SEAT NO.:" + seat_no[i] + " **");
  67. }
  68. System.out.println("** TOTAL AMOUNT:RM" + no_tic * 17 + " **");
  69. System.out.println("** THANK YOU **");
  70. System.out.println("***********************************************************");
  71. break;
  72. case 2:
  73. output_SystemExit();
  74. exit();
  75.  
  76. default:
  77. System.out.println("invalid case");
  78. }
  79. case 2:
  80. output_Booking("EJEN ALI MOVIE BOOKING", 2);
  81. ch1 = ind.nextInt();
  82. switch (ch1) {
  83. case 1:
  84. int index;
  85. System.out.print("\n NO. OF TICKETS:");
  86. no_tic = ind.nextInt();
  87.  
  88. for (int i = 0; i < 30; i++) {
  89. if ((i == 10) || (i == 20) || (i == 30)) {
  90. System.out.println("\n");
  91. }
  92. System.out.print(seat[i]);
  93. }
  94. System.out.println("\n**SELECT YOUR SEAT**");
  95. for (int i = 0; i < no_tic; i++) {
  96. seat_no[i] = ind.nextInt();
  97. index = seat_no[i];
  98. seat[index] = "x";
  99. }
  100. output_TicketHeader("AJEN ALI MOVIE");
  101. for (int i = 0; i < no_tic; i++) {
  102. System.out.println("** SEAT NO.:" + seat_no[i] + " **");
  103. }
  104. System.out.println("** TOTAL AMOUNT:RM" + no_tic * 17 + " **");
  105. System.out.println("** THANK YOU **");
  106. System.out.println("***********************************************************");
  107. break;
  108. case 2:
  109. output_SystemExit();
  110. exit();
  111.  
  112. default:
  113. System.out.println("invalid case");
  114. }
  115.  
  116. }
  117. }
  118. // TODO code application logic here
  119.  
  120. }
  121.  
  122. private static void exit() {
  123. // TODO Auto-generated method stub
  124. System.exit(0);
  125. }
  126.  
  127. public static void output_SystemExit() {
  128. System.out.println("*******************************");
  129. System.out.print("Thank you! \nPlease Come Again!");
  130. System.out.println("\n*******************************");
  131. }
  132.  
  133. public static void output_TicketHeader(String movie) {
  134. System.out.println("***********************************************************");
  135. System.out.println("** GSC TERENGGANU **");
  136. System.out.println("**DATE: ~" + movie + "~ TIMING: **");
  137. System.out.println("**18-11-18 7:00AM **");
  138. }
  139.  
  140. public static void output_Booking(String bookingMovie, int screen) {
  141. System.out.println("\n______________" + bookingMovie + "_____________");
  142. System.out.println("\n **************screen " + screen + "*************** ");
  143. System.out.println("\n 1.booking \n 2.exit ");
  144. }
  145.  
  146. }
  147. //EJEN ALI MOVIE BOOKING
  148. //FROZEN 2 MOVIE BOOKING
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement