1answer.
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
Neko [114]
3 years ago
9

Peter the postman became bored one night and, to break the monotony of the night shift, he carried out the following experiment

with a row of mailboxes in the post office. These mailboxes were numbered 1 through 150, and beginning with mailbox 2, he opened the doors of all the even-numbered mailboxes, leaving the others closed. Next, beginning with mailbox 3, he went to every third mail box, opening its door if it were closed, and closing it if it were open. Then he repeated this procedure with every fourth mailbox, then every fifth mailbox, and so on. When he finished, he was surprised at the distribution of closed mailboxes. Write a program to determine which mailboxes these were.
Engineering
1 answer:
aleksandrvk [35]3 years ago
7 0

Answer:

//This Program is written in C++

// Comments are used for explanatory purpose

#include <iostream>

using namespace std;

enum mailbox{open, close};

int box[149];

void closeAllBoxes();

void OpenClose();

void printAll();

int main()

{

closeAllBoxes();

OpenClose();

printAll();

return 0;

}

void closeAllBoxes()

{

for (int i = 0; i < 150; i++) //Iterate through from 0 to 149 which literarily means 1 to 150

{

box[i] = close; //Close all boxes

}

}

void OpenClose()

{

for(int i = 2; i < 150; i++) {

for(int j = i; j < 150; j += i) {

if (box[j] == close) //Open box if box is closed

box[j] = open;

else

box[j] = close; // Close box if box is opened

}

}

// At the end of this test, all boxes would be closed

}

void printAll()

{

for (int x = 0; x < 150; x++) //use this to test

{

if (box[x] = 1)

{

cout << "Mailbox #" << x+1 << " is closed" << endl;

// Print all close boxes

}

}

}

Explanation:

You might be interested in
Suppose we have a database for an investment firm, consisting of the following attributes: B (broker), O (office of a broker), I
Snowcat [4.5K]

Answer:

Given, FDs are:

S -> D

I -> B

IS -> Q

B -> O

a)

"I" and "S" must be there in any candidate key because they do not appear on the right side of any functional dependency.

The only candidate key is: IS

IS -> ISBDQO

b)

Decomposition of R into 3NF: (I, B), (S, D), (B, O), (I, S, Q)

c)

Decomposition of R into BCNF:

Decompose R by I → B into R1 = (I, B) and R2 = (I, O, S, Q, D).

R1 is in BCNF

Decompose R2 by S → D into R21 = (S, D) and R22 = (O, I, S, Q).

R21is in BCNF

Decompose R22 by I → O into R221 = (I, O) and R222 = (I, S, Q).

R221 is in BCNF.

R222 is in BCNF.

The decomposition is: (I, B), (S, D), (I, O), (I, S, Q)

We can also write it as: (I, B), (S, D), (B, O), (I, S, Q)

Explanation:

The answer above is rendered in a very explanatory way.

8 0
3 years ago
A utility generates electricity with a 36% efficient coal-fired power plant emitting the legal limit of 0.6 lb of SO2 per millio
Mama L [17]

Answer:

a) 570 kWh of electricity will be saved

b) the amount of  SO₂ not be emitted or heat of electricity saved is 0.00162 ton/CLF

c) $1.296 can be earned by selling the SO₂ saved by a single CFL

Explanation:

Given the data in the question;

a) How many kilowatt-hours of electricity would be saved?

first, we determine the total power consumption by the incandescent lamp

P_{incandescent} = 75 w × 10,000-hr = 750000 wh = 750 kWh

next, we also find  the total power consumption by the fluorescent lamp

P_{fluorescent} = 18 × 10000 = 180000 = 180 kWh

So the value of power saved will be;

P_{saved} = P_{incandescent}  - P_{fluorescent}

P_{saved} = 750 - 180

P_{saved}  = 570 kWh

Therefore, 570 kWh of electricity will be saved.

now lets find the heat of electricity saved in Bituminous

heat saved = energy saved per CLF / efficiency of plant

given that; the utility has 36% efficiency

we substitute

heat saved =  570 kWh/CLF / 36%

we know that; 1 kilowatt (kWh) = 3,412 btu per hour (btu/h)

so

heat saved =  570 kWh/CLF / 0.36 × (3412 Btu / kW-hr (

heat saved = 5.4 × 10⁶ Btu/CLF

i.e eat of electricity saved per CLF is 5.4 × 10⁶

b) How many 2,000-lb tons of SO₂ would not be emitted

2000 lb/tons = 5.4 × 10⁶ Btu/CLF

0.6 lb SO₂ / million Btu = x

so

x = [( 5.4 × 10⁶ Btu/CLF ) × ( 0.6 lb SO₂ /  million Btu )] / 2000 lb/tons

x = [( 5.4 × 10⁶ Btu/CLF ) × ( 0.6 lb SO₂ )] / [ ( 10⁶) × ( 2000 lb/ton) ]

x = 3.24 × 10⁶ / 2 × 10⁹

x = 0.00162 ton/CLF

Therefore, the amount of  SO₂ not be emitted or heat of electricity saved is 0.00162 ton/CLF

c)  If the utility can sell its rights to emit SO2 at $800 per ton, how much money could the utility earn by selling the SO2 saved by a single CFL?

Amount = ( SO₂ saved per CLF ) × ( rate per CFL )

we substitute

Amount = 0.00162 ton/CLF × $800

= $1.296

Therefore; $1.296 can be earned by selling the SO₂ saved by a single CFL.

3 0
3 years ago
What are the advantages of studying a scheduled course over a more freeform one?
anyanavicka [17]

Answer:

Taking responsibility for your own learning makes it easier to identify your strengths and weaknesses. Once these have been identified you can work on a learning plan that focuses on the areas that you need most help with, increasing the speed of your learning, and build the skills you have been trying to perfect.

Explanation:

8 0
3 years ago
Read 2 more answers
1kg of air (R 287 J/kgK) fills a weighted piston-cylinder device at 50kPa and 100°C. The device is cooled until the temperature
Reika [66]

Answer:

the work done during this cooling is −28.7 kJ

Explanation:

Given data

mass (m) = 1 kg

r = 287 J/kg-K

pressure ( p) = 50 kPa

temperature (T) = 100°C = ( 100 +273 ) = 373 K

to find out

the work done during this cooling

Solution

we know the first law of thermodynamics

pv = mRT     ....................1

here put value of p, m R and T and get volume v(a) when it initial stage in equation 1

50 v(a) = 1 × 0.287  × 373

v(a) = 107.051 / 50

v(a) = 2.1410 m³    .......................2

now we find out volume when temperature is  0°C

so put  put value of p, m R and T and get volume v(b) when temperature is cooled in equation 1

50 v(b) = 1 × 0.287  × 273

v(a) = 78.351 / 50

v(a) = 1.5670 m³    .......................3

by equation 2 and 3 we find out work done to integrate the p with respect to v i.e.

work done = \int\limits^a_b {p} \, dv

integrate it and we get

work done = p ( v(b) - v(a)  ) ................4

put the value p and v(a) and v(b) in equation 4 and we get

work done = p ( v(b) - v(a)  )

work done = 50 ( 1.5670 - 2.1410 )

work done = 50 ( 1.5670 - 2.1410 )

work done = 50 (−0.574)

work done = −28.7 kJ

here we can see work done is negative so its mean work done opposite in direction of inside air

'

7 0
3 years ago
1 Suppose Alice, Bob, and Carol want to use secret key technology to authenticate each other. If they all used the same secret k
Dmitry [639]

Answer:

Explained

Explanation:

Alice need to know the secret key of carol to verify the carol's answer to Alice challenges.

Similarly it needs the secret key of Bob to verify bob's answer  to Alice challenge (actually any of the three need others secret key for verify answer to challenge).

So, Bob could impersonate Carol to Alice as he should know the secret key of Carol to answer Carol's challenge. Hence it is no more secure than having all use the same secret key.

So, it is no more secure than having them all use the same secret key K.

6 0
3 years ago
Other questions:
  • Aaron needs to create a building design for a restaurant with colors that depict excitement and vibrancy. Which color can Aaron
    8·2 answers
  • Express the following quantities to the nearest standard prefix using no more than three digits.(a) 20,000,000 Hz(b) 1025 W(c) 0
    9·1 answer
  • At a certain location, wind is blowing steadily at 10 m/s. Determine the mechanical energy of air per unit mass and the power ge
    5·1 answer
  • Water is flowing in a metal pipe. The pipe OD (outside diameter) is 61 cm. The pipe length is 120 m. The pipe wall thickness is
    9·1 answer
  • For a steel alloy it has been determined that a carburizing heat treatment of 14 h duration at 809°C will raise the carbon conce
    13·1 answer
  • LINKS GET BODIED ON SITE! RAWR
    13·1 answer
  • Please solve part two
    7·1 answer
  • Please help me with this question
    9·1 answer
  • What is the correct procedure for mounting the m240 on the m122a1 tripod after the pintle is attached to the receiver?
    7·1 answer
  • How many and what type of<br> receptacles are connected to<br> this circuit?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!