15-100:
Introductory/Intermediate Programming
(Section F) |
Fall 2006 |
Relevant Reading:
Assignment: (worth 0 exercise points - this exercise is for practice only) Get the ex-practiceCounting.zip file. Use the files in this folder as your basis for this assignment. a) Write a program that allows the user to type in the name of a world and it appears on screen. Leave trace OFF. Check out the worlds: w1.txt, w2.txt, w3.txt, and w4.txt. In these worlds, there is a wall somewhere along the bottom row, and a wall somewhere along the leftmost column. b) Modify the program to put a robot at (1,1). The program should then report to the console window how many intersections there are on the bottom row before the wall. (EG If the wall is between avenues 5 and 6, the program should say There are 5 intersections on the bottom row. c) Modify the program to put a second robot at (1,1). The program should then report to the console window how many intersections there are in the leftmost column before the wall. (EG If the wall is between streets 5 and 6, the program should say There are 5 intersections in the leftmost column. d) If you did not do so above, create a class to support the behavior above. (Looping code that is repeated would make a good candidate for a method.) There should be no System.out.println commands in the new class. e) Modify the program to have a third robot put a beeper on every intersection on the bottom row till the wall. (The robot should start with exactly the right number of beepers.) f) Modify the program to have a fourth robot put a beeper on every intersection on the leftmost column till the wall. (The robot should start with exactly the right number of beepers.) Note that at this point, there will be 2 beepers at (1,1). Handin:
|