Consider the following scenario: A high school has 1000 students and 1000 lockers, one locker for each student. On the first day of school, the principal plays the following game: She asks the first student to open all the lockers. She then asks the second student to close all the even-numbered lockers. The third student is asked to check every third locker. If it is open, the student closes it; if it is closed, the student opens it. The fourth student is asked to check every fourth locker. If it is open, the student closes it; if it is closed, the student opens it. The remaining students continue this game. In general, the nth student checks every nth locker. If it is open, the student closes it; if it is closed, the student opens it. After all the students have taken turns, some of the lockers are open and some are closed. The program see in the photo, when ran, should ask the user to enter the number of lockers in the school. The program will output the number of lockers and the locker numbers of the ones that are open. The statements are in the wrong order, and there are some bugs in the program. Rearrange the statements (do not add other lines of code), find and remove the bugs so that the program can run properly. RENAME THE CLASS TO “LASTNAME_CLASSCODE_LOCKER”.
Consider the following scenario:
A high school has 1000 students and 1000 lockers, one locker for each student. On the first day of school, the principal plays the following game: She asks the first student to open all the lockers. She then asks the second student to close all the even-numbered lockers. The third student is asked to check every third locker. If it is open, the student closes it; if it is closed, the
student opens it. The fourth student is asked to check every fourth locker. If it is open, the student closes it; if it is closed, the student opens it. The remaining students continue this game. In general, the nth student checks every nth locker. If it is open, the student closes it; if it is closed, the student opens it. After all the students have taken turns, some of the lockers are open and some are closed.
The program see in the photo, when ran, should ask the user to enter the number of lockers in the school. The program will output the number of lockers and the locker numbers of the ones that are open. The statements are in the wrong order, and there are some bugs in the program. Rearrange the statements (do not add other lines of code), find and remove the bugs so that the
program can run properly. RENAME THE CLASS TO
“LASTNAME_CLASSCODE_LOCKER”.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images