uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

UseCase2_Main.java (1334B)


      1 import java.io.FileNotFoundException;
      2 import java.util.ArrayList;
      3 import java.util.Scanner;
      4 
      5 public class UseCase2_Main
      6 {
      7     public static void main(String[] args) throws FileNotFoundException {
      8         BoardCheck PlaneCheck = new BoardCheck();
      9         Scanner sc = new Scanner(System.in);
     10 
     11         // Passengers items are somehow scanned in a physical metal detector
     12         ArrayList<Item> PassengerItems = new ArrayList<>();
     13         PassengerItems.add(new Item("Metal", 0.1f, "Keys"));
     14         PassengerItems.add(new Item("Iron", 0.2f, "Coins"));
     15         PassengerItems.add(new Item("Plastic", 0.3f, "Phone"));
     16         PassengerItems.add(new Item("Leather", 0.2f, "Belt"));
     17 
     18         // Passengers ticket is scanned by personnel
     19         System.out.println("Enter ticket info");
     20         System.out.println("Enter flight ID : ");
     21         String fID = sc.nextLine();
     22         System.out.println("Enter Seat ID : ");
     23         String sID = sc.nextLine();
     24         System.out.println("Enter Ticket ID : ");
     25         String tID = sc.nextLine();
     26 
     27         Ticket PassengerTicket = new Ticket(null, fID, Integer.parseInt(sID), tID);
     28 
     29         if (PlaneCheck.CanBoard(PassengerTicket, PassengerItems))
     30             System.out.println("You may board the plane.");
     31         else
     32             System.out.println("You may not board the plane.");
     33     }
     34 }