forked from fhcwcsy/python_practice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogicGates.py
More file actions
38 lines (25 loc) · 905 Bytes
/
Copy pathlogicGates.py
File metadata and controls
38 lines (25 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class LogicGate :
def __init__( self, n ) :
self.label = n
self.output = None
def getLabel( self ):
return self.label
def getOutput( self ):
self.output = self.performGateLogic()
return self.output
class BinaryGate( LogicGate ):
def __init__( self, n ) :
LogicGate.__init__( self. n )
self.pinA = None
self.pinB = None
def getPinA( self ):
return int( input( "Enter Pin A input for gate " + self.getLabel() + "-->" ) )
def getPinB( self ):
return int( input( "Enter Pin B input for gate " + self.getLabel() + "-->" ) )
class UnaryGate( LogicGate ):
def __init__( self, n ) :
LogicGate.__init__( self, n )
self.pin = None
def getPin( self ):
return int( input( "Enter Pin input for gate " + self.getLabel() + "-->" ) )
class AndGate( BinaryGate ) :