voltage drop - operating a solenoid after a logic gate and a LED
I hope your circuit isn't homework, because you're getting the whole answer here.  As drawn, it will not work.  First, you need to actively pull the inputs to the AND gate high.  Second, you're activating the solenoid when the output of the AND gate is low (because the solenoid is connected to +5V on its other end).  Finally, you really don't want to drive a solenoid from a logic gate.

In the circuit below, R2 keeps the AND gate input low when the switches are open.  When SW1 is closed, current flows through R1 and D1, lighting it up.  The behavior is the same for SW2, R3, R4 and D2.

When SW1 and SW2 are closed, the output of the AND gate goes high.  Current flows through R6 and D4 and it lights, regardless of the state of SW3 (which I believe is your intent).  If SW3 is then closed, current will flow through R5 and into the base of Q1.  This will turn Q1 on, which will pull current through your solenoid.

D3 is there to save Q1.  When current is removed from the base of Q1 it will turn off suddenly.  If D3 were not there then L1 would resist the change in current by raising the voltage at the collector of Q1 -- for most combinations, it would do so enough to damage Q1.  D3 will conduct when the voltage at the gate of Q1 rises above 5V, limiting the voltage on Q1's collector, and saving it.

Key words that you may want to search on are elementary logic circuits, and transistor relay driver (or transistor solenoid driver, but usually the solenoid being driven is the coil of a relay, so that's what ends up in search terms).

Adjust the values of R1, R3 and R6 depending on your LEDs and your preference.  Choose Q1 to be herky enough to actually drive your solenoid, and choose R5 to actually drive Q1 into saturation (for hobbyist transistors it should flow 1/10 the collector current in saturation).  Or replace Q1 with a logic-level n-channel MOSFET that's rated for the current it'll need to carry, and either omit R5 altogether, or set it to 220\$\Omega\$ if it's a particularly big FET (to save your AND gate's output stage).  Similarly, size D3 according to how much current there will be flowing in the solenoid.







simulate this circuit &ndash; Schematic created using CircuitLab