answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Masteriza [31]
2 years ago
13

Simulate a circuit for controlling a hallway light that has switches at both ends of the hallway. Each switch can be up or down,

and the light can be on or off. Toggling either switch turns the lamp on or off. Provide member functions.
Computers and Technology
1 answer:
Dmitry [639]2 years ago
5 0

Answer:

int switch_1,switch_2;

int get_first_switch_state()

{

return switch_1;

}

int get_second_switch_state()

{

return switch_1;

}

int get_lamp_state()  

{

if((get_first_switch_state())

if(get_second_switch_state()) return 1;

else

if(!get_second_switch_state()) return 1;

return 0;

}

void toggle_first_switch()

{

  if(get_first_switch_state()) switch_1=0;

  else switch_1=1;

}

void toggle_second_switch()

{

if(get_second_switch_state()) switch_2=0;

else switch_2=1;

}

Explanation:

You might be interested in
Memory is a _____________ that includes the organization and shaping of information by processing, storage, and retrieval of inf
vaieri [72.5K]

Answer:

A. <em>Encoding Process </em>

Explanation:

Memory is an <em>encoding process </em>that includes the organization and shaping of information by processing, storage, and retrieval of information.

There are two types of memory in computing, <em>RAM </em>and <em>ROM</em>. <em>RAM </em>stands for <em>Random Access Memory</em>. It I the core memory of the computer and it is especially faster regarding reading and writing process. As an analogy, RAM memory is like the “<em>Short-term</em>” memory of the computer. <em>ROM </em>stands for <em>Read-Only Memory</em>, this is the type of memory in charge of permanently storing data in the computer. It contains the necessary information to run the computer. As an analogy, <em>ROM </em>memory is like the “<em>long-term</em>” memory of the computer.

3 0
1 year ago
Type the correct answer in the box. Spell all words correctly.
marysya [2.9K]

Answer:

A Standard Lens

Explanation:

Since David wants to take pictures of people around him and also the objects far away, a standard lens would be fit for that.

3 0
1 year ago
BlockPy: #35.2) Animal Splits Write a function all_cats that consumes a comma-separated string of animals and prints whether all
maks197457 [2]

Answer:

def all_cats(data):

 dataArray = data.split(',')

 if(data==""):

   return True

 for i in dataArray:

   if('cat' not in i):

     return False

 

 return True

print(all_cats("gerbil,catfish,dog,cat"))

print(all_cats("cat,catfish"))

print(all_cats(""))

Explanation:

Step 1: define de function and the parameters

def all_cats(data):

Step 2: split the data by ,

dataArray = data.split(',')

Step 3 : validate if is an empty data and return true

if(data==""):

   return True

Step 4: Loop over de array data and validate if have cat in each data if not, then return false

for i in dataArray:

   if('cat' not in i):

     return False

Step 5 if have cat in each one return true

return True

Step 6 Validate with examples

print(all_cats("gerbil,catfish,dog,cat"))

print(all_cats("cat,catfish"))

print(all_cats(""))

6 0
2 years ago
Nancy would like to configure an automatic response for all emails received while she is out of the office tomorrow, during busi
Stella [2.4K]

she can appoints someone she trust to act on her behalf

4 0
2 years ago
Read 2 more answers
Olivia started working last year. By April 15th, she will need to prepare and send the Federal government _____.
omeli [17]
Income tax documents
5 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following is not a benefit of active listening?
    8·1 answer
  • How efficient would a 6-bit code be in asynchronous transmission if it had 1 parity bit, 1 start bit, and 2 stop bits?
    5·1 answer
  • Assume that the reference variable r refers to a serializable object. Write code that serializes the object to the file ObjectDa
    8·1 answer
  • Row array gameScores contains all player scores. Construct a row array highScores than contains all player scores greater than m
    15·1 answer
  • Identify two entities and 2 of their attributes from the given scenario.
    9·1 answer
  • Write a method that takes three numerical String values and sums their values.
    14·2 answers
  • (1) Output a menu of automotive services and the corresponding cost of each service. (2 pts) Ex: Davy's auto shop services Oil c
    15·1 answer
  • Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to beco
    15·1 answer
  • What protocol communicates data between routers representing the edges of autonomous systems?Distance-vectorLink stateInterior g
    11·1 answer
  • Evie clicks through her presentation slides and realizes they all have transition effects coming from the same location, from th
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!