At the beginning of this course, we discussed about the importance of developing an algorithm in pseudo code before writing code. We reiterate the same point when discussing multiple phases of programming. Now it is a good time to review this process and keep in mind: programming is a multi-step process.
Have you worked on the pseudo code of this robot problem before? Can you turn the pseudo code into Java now?
B. Some Assumptions:
Let's assume the room size is 20x20 units, surrounded by four walls labeled #1-4. Use a random number to generate 1, 2 or 3 windows to install on the walls. All windows will have a width of 2 units, and at most 1 window can be installed on each wall. No window will wrap around a corner.
Write a program to count the number of windows. To start off, your program will first set up the windows, then ask the user " Where is the robot?". Instruct the user to enter 2 integers between 1 and 20 to tell the robot's location.
C. Your output should print:
- The numbers of windows the robot found in the room.
- The location of those windows.