uni

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

MetalDetector.java (733B)


      1 import java.util.ArrayList;
      2 
      3 public class MetalDetector {
      4     public int ID;
      5     public float Threshold;
      6     public ArrayList<Float> PreviousScans;
      7 
      8     public MetalDetector(int ID, float threshold) {
      9         this.ID = ID;
     10         Threshold = threshold;
     11         PreviousScans = new ArrayList<>();
     12     }
     13 
     14     public boolean ScanPassenger(ArrayList<Item> Items)
     15     {
     16         float total_thresh = 0;
     17         for (Item I : Items)
     18         {
     19             if (I.Material.equals("Metal")
     20             || I.Material.equals("Steel")
     21             || I.Material.equals("Iron"))
     22             {
     23                 total_thresh += I.Mass;
     24             }
     25         }
     26         PreviousScans.add(total_thresh);
     27         return Threshold > total_thresh;
     28     }
     29 
     30 }