BoardCheck.java (1138B)
1 import java.io.FileNotFoundException; 2 import java.util.ArrayList; 3 4 public class BoardCheck 5 { 6 TicketDB Database; 7 MetalDetector Detector; 8 9 public BoardCheck() throws FileNotFoundException 10 { 11 Database = new TicketDB(); 12 Detector = new MetalDetector(1, 0.5f); 13 } 14 15 16 public boolean CanBoard(Ticket T, ArrayList<Item>Items) 17 { 18 if (!Database.CheckTicket(T)) 19 { 20 System.out.println("Invalid ticket."); 21 return false; 22 } 23 if (!Detector.ScanPassenger(Items)) 24 { 25 System.out.println("Detected amount of metal exceeding mass threshold"); 26 System.out.println(Detector.PreviousScans.get(Detector.PreviousScans.size() - 1) 27 + "kg of metallic material detected on scan."); 28 return false; 29 } 30 31 System.out.println("Ticket is valid."); 32 System.out.println("Detected amount of metal is under mass threshold"); 33 System.out.println(Detector.PreviousScans.get(Detector.PreviousScans.size() - 1) 34 + "kg of metallic material detected on scan."); 35 return true; 36 } 37 }