Advertisement
Guest User

Swag

a guest
May 28th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import java.awt.List;
  2. import java.util.ArrayList;
  3. public class Conditional {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Person[] person = new Person[5];
  8. ArrayList<Person> suspects = new ArrayList<>();
  9.  
  10.  
  11. for (int i = 0; i<person.length; i++)
  12. {
  13. if (person[i].hair == HairColor.BLACK &&
  14. person[i].height >= 65 && person[i].height <= 68 &&
  15. person[i].race == Race.INDIAN &&
  16. person[i].age >= 20 && person[i].age <= 24)
  17. {
  18. suspects.add(person[i]);
  19. }
  20. }
  21.  
  22. }
  23.  
  24. }
  25.  
  26. class Person {
  27. HairColor hair;
  28. int height;
  29. Race race;
  30. int age;
  31. }
  32.  
  33. enum HairColor {
  34. BLACK,
  35. BROWN,
  36. BLONDE
  37. }
  38.  
  39. enum Race {
  40. BLACK,
  41. PURPLE,
  42. GREEN,
  43. INDIAN
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement