Advertisement
Guest User

logic.js

a guest
Mar 30th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class logic {
  2.   AND(x,y)
  3.   {
  4.     if(x && y) return 1;
  5.     else return 0;
  6.   }
  7.  
  8.   OR(x,y)
  9.   {
  10.     if(x || y) return 1;
  11.     else return 0;
  12.   }
  13.  
  14.   NOT(x)
  15.   {
  16.     if(!x) return 1;
  17.     else return 0;
  18.   }
  19.  
  20.   NAND(x,y)
  21.   {
  22.     if(this.NOT(this.AND(x,y))) return 1;
  23.     else return 0;
  24.   }
  25.  
  26.   NOR(x,y)
  27.   {
  28.     if(this.NOT(this.OR(x,y))) return 1;
  29.     else return 0;
  30.   }
  31.  
  32.   XOR(x,y)
  33.   {
  34.    if(this.OR(x,y) && this.NAND(x,y)) return 1;
  35.    else return 0;
  36.   }
  37.  
  38.   XNOR(x,y)
  39.   {
  40.     if(this.NOT(this.XOR(x,y))) return 1;
  41.     else return 0;
  42.   }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement