A school has 100 lockers and 100 students. All lockers are closed on the first day of school. As the students enter, the first student, denoted S1, opens every locker. Then the second student, S2, begins with the second locker, denoted L2, and closes every other locker (i.e. every even numbered locker). Student S3 begins with the third locker and changes every third locker (closes it if it was open, and opens it if it was closed). Student S4 begins with locker L4 and changes every fourth locker. StudentS5 starts with L5 and changes every fifth locker, and so on, until student S100 changes L100.After all the students have passed through the building and changed the lockers, which lockers areopen? Write a program to find your answer.(Hint: Use an array of 100 boolean elements. each of which indicates whether a locker is open (true) or closed (false). Initially, all lockers are closed.)

Answers

Answer 1

Solution :

public class NewMain {  

   public_static void main_(String[] args) {  

       boolean[] _locker = new boolean_[101];  

       // to set all the locks to a false NOTE:  first locker is the number 0. Last locker is the 99.

       for (int_i=1;i<locker_length; i++)

       {

       locker[i] = false;

       }

       // first student opens all lockers.

       for (int i=1;i<locker.length; i++)        {

       locker[i] = true;

       }

       for(int S=2; S<locker.length; S++)

       {

          for(int k=S; k<locker.length; k=k+S)

          {

              if(locker[k]==false) locker[k] = true;

              else locker[k] = false;      

          }            

       }

       for(int S=1; S<locker.length; S++)

       {

           if (locker[S] == true) {

               System.out.println("Locker " + S + " Open");

           }

         /* else {

               System.out.println("Locker " + S + " Close");

           } */

       }

   }

}


Related Questions

name 20 input device​

Answers

Answer:

I wish that is helpful

.........

Answer:

Some Input devices are;

KeyboardMouseLight penMicrophoneDocument scannerCharacter readerBar-Code readerTrack pointTouch padTrack ballDigital cameraMagnetic Ink Character readerMagnetic stripTouch screen

it is an electronic device that capable of accessing accepting processing product and storing data​

Answers

"A computer is an electronic device for storing and processing data, typically in binary form, according to instructions given to it in a variable program." "A computer is an electronic device that manipulates information, or data. It has the ability to store, retrieve, and process data."

You are going on vacation and want to take some work files. You need a storage device that is small enough to fit in your bag and preferably one that does not have plugs. Which device should you bring?


hard drive bus

flash drive

external hard drive

storage card

Answers

Answer:

Flash drive

Explanation:

Given the following table of students, assignments, and grades for a single class:

Student_ID

Student_Name

Assignment_1_Date

Assignment_1_Name

Assignment_1_Grade

Assignment_2_Date

Assignment_2_Name

Assignment_2_Grade

Assignment_3_Date

Assignment_3_Name

Assignment_3_Grade

1011

Susan J. Smith

2015-06-01

Homework - Chapter Seven

76

2015-06-05

Chapter 7 Quiz

88

2015-06-12

Homework – Chapter 8

A

2332

Jones, Jamal K.

2015-06-01

Homework - Chapter Seven

84

2015-06-05

Quiz – Chapter 7

89

2015-06-12

Homework – Chapter 8

95

3432

Brown, Ronald

2015-06-01

Homework - Chapter Seven

66

2015-06-05

Quiz – Chapter 7

78

2015-06-12

Homework – Chapter 8

B

5435

Killen, Katie

2015-06-01

Homework - Chapter Seven

97

2015-06-05

Chapter 7 – Quiz

95

2015-06-12

Homework – Chapter 8

94

7574

Powell, B.

2015-06-01

Homework - Chapter Seven

68

2015-06-05

Quiz – Chapter 7

89

9677

Pat Hayes

6/1/2015

Homework - Chapter Seven

89

2015-06-05

Quiz – Chapter 7

85

2015-06-12

Homework – Chapter 8

99

Examine the data in the table above and identify any columns that contain data inconsistencies. Place an X in the Consistent or Inconsistent column.

Answers

Answer:

i need more

Explanation:

i need more

Which artistic technique uses multiple layers of small calligraphic or scribbled marks?
A. random hatching
B. crosshatching
C. shading
D. stippling
E. scrumbling

Answers

I would go with C.shading. It just makes the most sense

Answer:

E. scrumbling

Explanation:

Have you ever tried using such a camera?​

Answers

Answer: yeah i mean i use my canon camera

Explanation:

3/4+7=
what is the answer​

Answers

Answer:

7 3/4

Explanation:

3

4

+ 7

=  (0 + 7) + (  

3

4

+ 0 )

=  7 +  

3

4

+ 0 × 4

=  7 +  

3

4

+  

0

4

=  7 +  

3 + 0

4

=  7 +  

3

4

=  

7 3

4

Which situations are the most likely to use telehealth? Select 3 options.

Your doctor emails a suggested diet plan.

Your brother was tested for strep throat and now you think you have it.

Your doctor invites you to use the patient portal to view test results.

You broke your arm and need a cast

You request an appointment to see your doctor using your health app.

Answers

Answer:

Your doctor emails a suggested diet plan.

Your brother was tested for strep throat and now you think you have it.

Your doctor invites you to use the patient portal to view test results.

Answer:

Your doctor emails a suggested diet plan

You request an appointment to see your doctor using your health app

Your doctor invites you to use the patient portal to view test results

Explanation:

Edge 2022

Write a program that computes how much each person in a group needs to pay (after tax and tip) when splitting the bill equally. Specifically, your program should: 1. Ask a user for the number of people in the party 2. Ask a user for the total bill amount before tax and tip 3. Output the amount due per person after tax and tip Assume that tax is 7.25%, and tip is 20% (tip is before tax).

Answers

Tax is an incredibly weird thing but I wish I could help but I can’t

Which statement is true for slide or positive film?
A.
Slides or positive films give low color saturation and contrast.
B.
Slides or positive films give high quality pictures with higher color saturation and contrast.
C.
Slide or positive films cannot be used to digitize and scan pictures.
D.
Slide or positive films are useful for cheaper compact cameras.

Answers

Answer:

B.

Slides or positive films give high quality pictures with higher color saturation and contrast.

Explanation:

The above is true for slides with positive film. This is because, the positive film happens to have a high resolution when it was been used thereby giving out a high quality video at the end of the recording. The higher colour saturation and contrast are also an attribute of a slide  or positive film.

Answer:

B

Explanation:

1. It is a set of integrated devices that input, output,
process, and store data and information.
a. Computer hardware
b. Computer software
c. Computer system
d. Computer program​

Answers

A set of integrated devices that input, output, process, and store data and information is called: C. Computer system.

What is a computer system?

A computer system can be defined as an electronic device that is designed and developed to receive data in its raw form as input and processes these data into an output (information) that could be used by an end user.

The components of a computer.

Basically, the components of a computer system are classified as follows:

MotherboardCentral processing unit (CPU)Output Input

Read more on computer system here: brainly.com/question/959479

Select the correct answer.

The idea that different aspects of health influence each other is known as _____ .

A.

Holistic health

B.

Happy health

C.

Integral health

D.

Perfect health

Answers

Answer:

A.  Holistic health

Explanation:

Holistic health refers to the method of caring the entire body. It includes physical, mental and emotional health of the individual. The overall health of an individual depends on the fitness of al these aspects of the body. The mind, body and the soul are considered to be interdependent and therefore the fitness of the body depends on the fitness of all of these parts.

Answer:

A

Explanation:

The definition of holistic is relating to the idea that things should be studied as a whole and not just as a sum of their parts. An example of holistic is health care that focuses on the health of the entire body and mind and not just parts of the body.

Save an image as a separate file by right-clicking the image and then clicking this option at the
shortcut menu
A) Save page as
B) Save Picture as
C) Save Image as
D) None of the above

Answers

Answer:

Save image as

Explanation:

Save image as. Because you are saving the image.

2. BIOS is contained in ROM and not in RAM. Can you guess why?​

Answers

Answer:

Because RAM is only used for short term storage (and doesn't contain anything that will need to be accessed often) RAM it loses its contents when turned off. So when you power on a computer, it has to start running bootup code which has to be stored in ROM

identify similarities and differences of hibiscus leaves

Answers

Answer:

I'm sorry but I cant answer if it's only one product,it should be two..it's like different to what,or similar to what

5.18 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a comma, including the last one. Ex: If the input is: 5 2 4 6 8 10 the output is: 10,8,6,4,2, To achieve the above, first read the integers into a vector. Then output the vector in reverse.

Answers

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main(){

   int len, num;

   vector<int> vect;

   cout<<"Length: ";

   cin>>len;  

   for(int i = 0; i<len;i++){

       cin>>num;

   vect.push_back(num);}

   vector<int>::iterator iter;

   for (iter = vect.end() - 1; iter >= vect.begin(); iter--){

       cout << *iter << ", ";}    

}

Explanation:

This declares the length of vector and input number as integer

   int len, num;

This declares an integer vector

   vector<int> vect;

This prompts the user for length  

cout<<"Length: ";

This gets the input for length  

   cin>>len;  

The following iteration gets input into the vector

   for(int i = 0; i<len;i++){

       cin>>num;

   vect.push_back(num);}

This declares an iterator for the vector

   vector<int>::iterator iter;

The following iterates from the end to the beginning and prints the vector in reverse

   for (iter = vect.end() - 1; iter >= vect.begin(); iter--){

       cout << *iter << ", ";}


When you
you can use the diverse knowledge sets of a team and share a workload.
O strategize
O quantify
discriminate
I
O collaborate

Answers

Answer:

Collaborate.

Explanation:

It was correct for me!

Answer:collaborate

Explanation:

cs edgen 100%

apples and bananas apples and bananas

Answers

Answer:

bananas and apples bananas and apples?

Explanation:

Answer:

these are good for me

Explanation:

yeye

The math club starts with 5 members. Five months later, their membership has grown to 50 members.
What was the average number of members who joined the math club per month?​

Answers

Explanation:

10 members per month i think

Answer:

10 members per month

Explanation:

brainliest pls its right i think

have a good day :D

This component of the CPU is responsible for fetching the data, converting it, and de-converting
A) ALU
B) RAM
C) Control Unit
D) None of the above

Answers

Answer : C.Control Unit

Reason

In CPU there are two components name ALU and CU(Control unit) which ALU's function is to solve mathematic sequence and CU fuction is to vetch data to memory and manage commands and input & output.

#See pic for how the data proceed

What is Open Source Software​

Answers

Answer:

Open-source software is a type of computer software in which source code is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software to anyone and for any purpose

Explanation:

A data science experiment you are conducting has retrieved two historical observations for the price of Bitcoin(BTC) on December 2, 2017 of 11234 and 12475. Create a Python script that stores these two historicalobservations in a list variable namedbtcdec1.Your data science experiment requires four additional data tasks. The first task is to use the listappend()method to add the BTC price of 14560 to the listbtcdec1. The second task is to create a new empty listnamedbtcdec2and append the BTC prices of 15630, 12475, and 14972. The third task required you to usethe listextend()method to add the contents ofbtcdec2into the listbtcdec1. The fourth and final taskrequires you to use the listsort()method of the listbtcdec1to sort the items in the newly extended list,then use theprintstatement to output the content of listbtcdec1to the Python console.Starter code:_______.

Answers

Answer:

Following are the code to this question:

btcdec1=[11234, 12475] #defining a list btcdec1 that holds two integer values  

btcdec1.append(14560)#using append method to add value in btcdec1 list

btcdec2=[]#defining an empty list btcdec2

btcdec2.append(15630)#using append method to add value in btcdec2 list

btcdec2.append(12475)#using append method to add value in btcdec2 list

btcdec2.append(14972)#using append method to add value in btcdec2 list

btcdec1.extend(btcdec2)#using the extend method to add value list into btcdec1

btcdec1.sort()#using sort method to arrange value in ascending order

print(btcdec1)#print list btcdec1

Output:

[11234, 12475, 12475, 14560, 14972, 15630]

Explanation:

In this code a list "btcdec1" is declared, which holds two integer variables, in the next step, it uses the append method to add another element into the list.

In the next step, another empty list "btcdec2" is declared, which uses the append method to hold the integer element, and uses the extend and sort method to add the second list into the first one and then sort the whole list and print its values.  

Use the five-step decision-making process discussed in Chapter 1 to analyze the following situations and recommend a course of action.

You are a new salesperson at a large software manufacturing firm. It is three weeks from the end of the sales quarter and you and your sales manager are sitting pretty—you have both already met your sales quota for the quarter. In addition, you just closed another deal with a new customer for $100,000 of software and customer service. This order would put you way over your sales quota for the current quarter. Your manager suggests that you hold this new order so it gets recorded against next quarter. She explains that because sales during the next three months tend to slow down, salespeople frequently miss their quotas and associated sales bonuses for that quarter. Holding this large order to next quarter would help you get an excellent start and almost guarantee that you meet your quota. What would you do?

Answers

Answer:

The responses to this question can be defined as follows:

Explanation:

Yeah, their numerous sponsorships brands have potential. Every business does have its Trademarks for a commodity, that distinguishes others. It's an infringement for trademarks, it has only provided to those trivialities, which success and if I would plan this for my friend. I would never list or show those points of his accomplishments I never would Numerous sponsors. This should include all its information using its trademarks as well as other Site partners are excluded even though they are or are browsing their trademarks where the law is prohibited.

Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/kmâpick one) and a certain amount of fuel in the gas tank. The efficiency is specified in the constructor, and the initial fuel level is 0. Supply a function drive that simulates driving the car for a certain distance, reducing the fuel level in the gas tank, and functions get_gas, to return the current fuel level, and add_gas, to tank up. Sample usage:Car my_beemer(29); // 29 miles per gallonmy_beemer.add_gas(20); // Tank 20 gallonsmy_beemer.drive(100); // Drive 100 milescout << my_beemer.get_gas() << "\n"; // Print fuel remaining

Answers

Answer:

class Car(object):

   fuel = 0

   def __init__(self, mpg):

       self.mpg = mpg

   def drive(self, mile):

       if self.fuel * self.mpg >= mile:

           self.fuel -= mile / self.mpg

       else:

           print(f"get gas for your {self}")

       print(f"Fuel remaining: {self.fuel}")

   #classmethod

   def get_gas(cls):

       cls.fuel += 50

   #classmethod

   def add_gas(cls, gallon):

       if cls.fuel + gallon > 50:

           cls.fuel += 10

       else:

           cls.fuel += gallon

gulf = Car(20)

gulf.get_gas()

gulf.drive(200)

Explanation:

The Car class is defined in Python. Its drive method simulates the driving of a car with fuel that reduces by the miles covered, with efficiency in miles per gallon. The get_gas and add_gas methods fill and top up the car tank respectively.

Companies sometimes pay search engine companies to have their websites located at the top of the search results. Do you think this is fair/ethical?

Answers

Answer:

I really don't think that it is fair or ethical.

Explanation:

When companies pay to put their websites at the top it is known as an ad. They are in top search engines like the ones we use every day. I believe this is unethical because it often results in confusion and sometimes misleads the user as the titles often use clickbait.

You should write the client so that it sends 10 ping requests to the server, separated by approximately one second. Each message contains a payload of data that includes the keyword PING, a sequence number, and a timestamp. After sending each packet, the client waits up to one second to receive a reply. If one second goes by without a reply from the server, then the client assumes that its packet or the server's reply packet has been lost in the network.Hint: Cut and paste PingServer, rename the code PingClient, and then modify the code. The two programs follow very similar process.You should write the client so that it starts with the following command:java PingClient host portwhere host is the name of the computer the server is running on and port is the port number it is listening to. Note that you can run the client and server either on different machines or on the same machine.The client should send 10 pings to the server. Because UDP is an unreliable protocol, some of the packets sent to the server may be lost, or some of the packets sent from server to client may be lost. For this reason, the client cannot wait indefinitely for a reply to a ping message. You should have the client wait up to one second for a reply; if no reply is received, then the client should assume that the packet was lost during transmission across the network. You will need to research the API for DatagramSocket to find out how to set the timeout value on a datagram socket.When developing your code, you should run the ping server on your machine, and test your client by sending packets to localhost (or, 127.0.0.1). After you have fully debugged your code, you should see how your application communicates across the network with a ping server run by another member of the class.Message FormatThe ping messages in this lab are formatted in a simple way. Each message contains a sequence of characters terminated by a carriage return character (r) and a line feed character (n). The message contains the following string:PING sequence_number time CRLFwhere sequence_number starts at 0 and progresses to 9 for each successive ping message sent by the client, time is the time when the client sent the message, and CRLF represent the carriage return and line feed characters that terminate the line.

Answers

Answer:

figure it out urself

Explanation:

What happens when two users attempt to edit a shared presentation in the cloud simultaneously? The second user is unable to open the presentation. When the second user logs on, the first user is locked out. A presentation cannot be shared in the cloud for this reason. A warning notice will alert the users that the presentation is in use.

Answers

Answer:

a warning notice will alert the users that the presentation is in use

Explanation:

I did it on edge

Answer:

D; A warning notice will alert the users that the presentation is in use.

Explanation:

Edge

Write the definition of the function inputArray that prompts the user to input 20 numbers and stores the numbers into alpha. Write the definition of the function double Array that initializes the elements of beta to two times the corresponding elements in alpha. Make sure that you prevent the function from modifying the elements of alpha. Write the definition of the function copy AlphaBeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. Make sure that you prevent the function from modifying the elements of alpha and beta. Write the definition of the function printArray that prints any one-dimensional array of type int. Print 15 elements per line.

Answers

Answer:

In Java:

public static  int[] inputArray(){

   Scanner input = new Scanner(System.in);

   int[] alpha = new int[20];

   for(int i = 0;i<20;i++){

       alpha[i] = input.nextInt();

   }

   return alpha;}

public static  int[] doubleArray(int [] alpha){

   int[] beta = new int[20];

   for(int i = 0;i<20;i++){

       beta[i] = 2 * alpha[i];

   }

   return beta;

}

public static int[] copyAlphaBeta(int [] alpha, int [] beta){

   int [] AlphaBeta = new  int[10];

   for(int i = 0;i<5;i++){

       AlphaBeta[i] = alpha[i];

   }

   int count = 5;

   for(int i = 15;i<20;i++){

       AlphaBeta[count] = beta[i];

       count++;

   }

   return AlphaBeta;

}

public static void printArray(int [] alpha){

   for(int i = 0;i<20;i++){

       System.out.print(alpha[i]+" ");

       if((i+1)%15 == 0){

           System.out.println(" ");

       }

   }

}

Explanation:

The inputArray is defined here

public static  int[] inputArray(){

   Scanner input = new Scanner(System.in);

This declares alpha array of 20 elements

   int[] alpha = new int[20];

The following iteration gets input from the user into the array

   for(int i = 0;i<20;i++){

       alpha[i] = input.nextInt();

   }

This returns the alpha array

   return alpha;}

The doubleArray is defined here. It takes the alpha array as its input parameter

public static  int[] doubleArray(int [] alpha){

This declares beta of 20 integers

   int[] beta = new int[20];

This populates beta by 2 * alpha[i]

   for(int i = 0;i<20;i++){

       beta[i] = 2 * alpha[i];

   }

This returns the alpha array

   return beta;}

The copyAlphaBeta array is defines here

public static int[] copyAlphaBeta(int [] alpha, int [] beta){

This declares AlphaBeta as 10 elements

   int [] AlphaBeta = new  int[10];

This populates the first 5 elements of AlphaBeta with the first 5 of alpha

   for(int i = 0;i<5;i++){

       AlphaBeta[i] = alpha[i];

   }

   int count = 5;

This populates the last 5 elements of AlphaBeta with the last 5 of beta

   for(int i = 15;i<20;i++){

       AlphaBeta[count] = beta[i];

       count++;

   }

This returns the AlphaBeta array

   return AlphaBeta;

}

The printArray is defined here. It takes the alpha array as its input parameter

public static void printArray(int [] alpha){

This iterates through alpha array

   for(int i = 0;i<20;i++){

This prints each element of the array

       System.out.print(alpha[i]+" ");

A new line is started after the 15th element

       if((i+1)%15 == 0){

           System.out.println(" ");

       }

   }

}

See attachment for complete program which includes the main

Write a python program that gets a number using keyboard input. If the number is positive, the program should call countdown

Answers

Answer:

def countdown():

 print("This is countdown")

number = int(input("Enter number: "))

if (number > 0):

 countdown()

Explanation:

This is literally what you asked, but what is the purpose?

Which of the following would be considered software? Select 2 options.
memory
printer
operating system
central processing unit (CPU)
Microsoft Office suite (Word, Excel, PowerPoint, etc.)
Thing

Answers

Answer:

Microsoft Office suite (Word, Excel, PowerPoint, etc.), and thing

Explanation:

The Operating system and Microsoft Office suite will be considered as software.

A Software is the opposite of Hardware in a computer system.

Let understand that Software means some set of instructions or programs on a computer which are used for operation and execution of specific tasks.

There are different type of software and they include:

Application Software are software installed into the system to perform function on the computer E.g. Chrome.System Software is the software designed to provide platform for other software installed on the computer. Eg. Microsoft OS. Firmware refers to set of instructions programmed on a hardware device such as External CD Rom.

In conclusion, the Operating system is a system software while the Microsoft Office suite is an application software.

Learn more about Software here

brainly.com/question/1022352

Other Questions
please help, due soon! IQ scores are normally distributed with mean mu equals 100 and standard deviation sigma equals 15. Calculate the standard deviation of the sampling distribution using a sample size of 25.0.620.03.04.0 In 1933, work by Irne and Frdric Joliot-Curie proved Einsteins prediction. They produced:A. the first working model of a nuclear bomb.B. an equation to calculate the fusion reaction inside a star.C. produced an x-ray crystallography image of a nucleus.D. produced a photograph that showed the creation of two particles when a particle of light was destroyed. A positive net credit position would indicate that Which of the following best describes the existence of undecidable problems? A. Undecidable problems are problems for which more than one algorithm solves the problem and computer scientists have not yet chosen the algorithm they believe is best B. Undecidable problems are problems for which an algorithm can be written that will produce the same output for at least two possible inputs C. Undecidable problems are problems for which an algorithm can be written that produces a correct output for all inputs but in an unreasonable time D. An undecidable problem is a problem for which no algorithm can be constructed that always produces a correct output What type of character is Grendel? A cylinder-shaped candle has a diameter of 5 inches and a height of 8 inches. what is the volume of the cylinder? use 3.14 for pi. round to the nearest tenth, if necessary. responses 62.8 in 62.8 in 125.6 in 125.6 in 157 in 157 in 628 in When the lengths of the All sides are diffrent that type of triangle is called *? The value of information is directly linked to how it helps decision makers achieve the organization's goals. what is the proportion for y: 11/y=8/5 rounded the to the nearest tenth Which list includes only biotic parts of an ecosystem write the point-Slope form of the line passing through the point (6,9) with a slope of 5I need answers fast please! what kind of credit inquiry has no effect on your credit score? Given: ACBD;ACBD 1) Is the Parellelogram a square? ___WRITE THE NUMBER OF THE THEOREMS THAT SUPPORT YOUR ANSWER:2) ACBD Theorem? ____3) ACBD Theorem? _____ "While I nodded nearly napping..." contains an example of what literary device ? Fill in the BlankComplete the following sentence. The combined in-depth study of a system and its analysis of relative parts in an effort to find desired understanding is called __________. Select the misconception about food safety that you saw in the video.Food sources in the United States are closely monitored by the FDA.There are millions of bacteria.You do not have to wash a cutting board between cutting different foods.All bacteria are pathogens. what is a good strategy if you want to improve your credit score? What is your party's main goal? (What do you want to achieve as a party within the school/classroom?)context: it is something that has to do with history and is like something from a political party thankI needed righ now plisss fast Fill out the puzzle with the correct word or group of words. (CROSSWORD PUZZLE) (11 letters)1. the basis of punishment of hammurabi's code of laws (13 letters) 2. the condition of whether or not a person intends to commit a crime beforehand. (19) 3. The event that marked the captured jerusalem(7) 4. The Assyrian's symbol of pride and cruelty(6) 5. The first empire builders(9) 6. "stargazers of babylon"(9 )7.The first people to work out an effective system of political administration(8 )8. the first group pf people who used iron for weapons(6 )9. a group of independent states brought together under a control ofa ruler(10 )10. the most important gift of babylonians to civilization.Book: turning points in asian history (revised edition), page 116