Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. public void changeGate() {
  2.  
  3. Flight vol = promptForFlight();
  4.  
  5.  
  6. char ancienTerminal= vol.getGate().charAt(0);
  7.  
  8. int ancienGate = vol.getGate().charAt(2);
  9.  
  10. /* String company, int flightNumber, String destination,int departureTime, String gate, String status*/
  11.  
  12.  
  13. System.out.print("Terminal (A, B, C): ");
  14.  
  15. String terminal = scan.next();
  16.  
  17. System.out.print("Gate Number: ");
  18.  
  19. int gateNumber = scan.nextInt();
  20.  
  21.  
  22. vol.setGate(terminal + "-" + gateNumber);
  23.  
  24.  
  25. airport.notifyObservers();
  26. if(vol.getGate().charAt(0)!=ancienTerminal && vol.getGate().charAt(2)!= ancienGate){
  27.  
  28. findTerminal(vol).removeFlight(vol);
  29. findGate(vol).removeFlight(vol);
  30. }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. switch(terminal) {
  38. case "A":
  39. termA.addFlight(vol);
  40.  
  41.  
  42. gatesA[gateNumber - 1].addFlight(vol);
  43.  
  44.  
  45. break;
  46. case "B":
  47.  
  48. termB.addFlight(vol);
  49.  
  50. gatesB[gateNumber -1].addFlight(vol);
  51.  
  52.  
  53. break;
  54. case "C":
  55.  
  56. termC.addFlight(vol);
  57.  
  58.  
  59. gatesC[gateNumber - 1].addFlight(vol);
  60.  
  61.  
  62.  
  63.  
  64.  
  65. break;
  66. }
  67.  
  68.  
  69.  
  70.  
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement