Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1.  
  2. public class NumberTwo
  3. {
  4.  
  5. public static void main(String[] args)
  6. {
  7.  
  8. boolean compProp;
  9.  
  10. boolean[] values = {true, false};
  11.  
  12. String ans = "false";
  13.  
  14. System.out.println("p q r s 1 2 3 4 5");
  15. for(boolean p : values)
  16. {
  17. for(boolean q : values)
  18. {
  19. for(boolean r : values)
  20. {
  21. for(boolean s : values)
  22. {
  23.  
  24. compProp = (p || q || !r) && (p || !q || !s) && (p || !r || !s) && (!p || !q || !s) && (p || q || !s);
  25.  
  26.  
  27. System.out.println(p + " " + q + " " + r + " " + s + " " + ((p || q || !r) && (p || !q || !s) && (p || !r || !s) && (!p || !q || !s) && (p || q || !s)));
  28.  
  29.  
  30. if(compProp)
  31. {
  32. ans = "true";
  33. break;
  34. }
  35.  
  36. }
  37. }
  38. }
  39. }
  40.  
  41.  
  42. System.out.print("The outcome of the compound proposition is " + ans);
  43.  
  44.  
  45.  
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement