public HalfAdder() { //your code here ag = new AndGate(); xog = new XorGate(); ag.ConnectInput1(Input1); ag.ConnectInput2(Input2); xog.ConnectInput1(Input1); xog.ConnectInput2(Input2); CarryOutput = ag.Output; Output = xog.Output; }
public HalfAdder() { CarryOutput = new Wire(); and = new AndGate(); xor = new XorGate(); Input1 = and.Input1; Input2 = and.Input2; xor.ConnectInput1(Input1); xor.ConnectInput2(Input2); Output = xor.Output; CarryOutput = and.Output; }
//your code here public HalfAdder() { //your code here XorGate xor = new XorGate(); AndGate and = new AndGate(); xor.ConnectInput1(Input1); xor.ConnectInput2(Input2); and.ConnectInput1(Input2); and.ConnectInput2(Input1); Output = xor.Output; CarryOutput = and.Output; }
public HalfAdder() { CarryOutput = new Wire(); xor = new XorGate(); and = new AndGate(); xor.ConnectInput1(Input1); xor.ConnectInput2(Input2); and.ConnectInput1(Input1); and.ConnectInput2(Input2); CarryOutput.ConnectInput(and.Output); Output.ConnectInput(xor.Output); }
public HalfAdder() { //your code here m_gXor = new XorGate(); m_gAnd = new AndGate(); m_gXor.ConnectInput1(Input1); m_gXor.ConnectInput2(Input2); Output.ConnectInput(m_gXor.Output); m_gAnd.ConnectInput1(Input1); m_gAnd.ConnectInput2(Input2); CarryOutput = new Wire(); CarryOutput.ConnectInput(m_gAnd.Output); }
public HalfAdder() { CarryOutput = new Wire(); var gXor = new XorGate(); var gAnd = new AndGate(); Input1 = gAnd.Input1; Input2 = gAnd.Input2; gXor.ConnectInput1(Input1); gXor.ConnectInput2(Input2); Output = gXor.Output; CarryOutput = gAnd.Output; }
// creating the halfadder by using the "xor" and "and gates" for the output and the carry public HalfAdder() { // initilaize the gates CarryOutput = new Wire(); xor_op = new XorGate(); and_op = new AndGate(); //xor operation for the sum output xor_op.ConnectInput1(Input1); xor_op.ConnectInput2(Input2); //and operation for the carry output and_op.ConnectInput1(Input1); and_op.ConnectInput2(Input2); //connecting outputs Output.ConnectInput(xor_op.Output); CarryOutput.ConnectInput(and_op.Output); }
public FullAdder() { CarryInput = new Wire(); //your code here CarryOutput = new Wire(); m_halfAdder1 = new HalfAdder(); m_halfAdder2 = new HalfAdder(); m_xorGate = new XorGate(); m_halfAdder1.ConnectInput1(Input1); m_halfAdder1.ConnectInput2(Input2); m_halfAdder2.ConnectInput1(m_halfAdder1.Output); m_halfAdder2.ConnectInput2(CarryInput); m_xorGate.ConnectInput1(m_halfAdder1.CarryOutput); m_xorGate.ConnectInput2(m_halfAdder2.CarryOutput); Output.ConnectInput(m_halfAdder2.Output); CarryOutput.ConnectInput(m_xorGate.Output); }