1. (10 points) Chapter 2: Self-check problems #4, #15, #20, #28 and #32.
If you use 2nd edition: Self-check problems #4, #12, #15, #25 and #27.
For your benefit, I suggest you complete all of the self-check problems on your own. However, I will just collect the answers to the above five problems.
a. NO NEED to copy original questions, just put down the question number and the answer.
b. Name the file as “LastnameFirstname2.doc” (or “.docx” or “.pdf”, where “Lastname” is your last name, and “Firstname” is your first name), submit it online.
2. (40 points) Chapter 2: Programming Project #7, “Space Needle”.
If you use 2nd edition: Programming Project #6
a. Download the attached “SpaceNeedle.java” file.
b. Modify it so that the code outputs the exact figure as specified in the problem (fixed size of 4). This includes having identical characters and spacing.
c. A major part of this assignment is to show your understanding of for loops. So if you simply use a series of System.out.println to print each line of the figure, you would not receive full credit. Identify repeated patterns of characters that vary in number from line to line, and represent them using for loops or nested for loops.
d. Another significant component of this assignment is to generalize the program using a single class constant that can be changed to adjust the size of the figure. A good development strategy is to start without the constant, making your program work at size 4. Then, generalize by introducing one (and only one) constant, and try setting it to different sizes.
e. For your convenience, some expected outputs for different sizes are attached as .txt files. You can compare them with the outputs of your program to check the correctness of your solution. Also, don’t forget to set the constant to 4 before submitting.
f. This program is intended to test your knowledge through Chapter 2, especially nested for loops. If you like, you may also use the Java features from Chapter 3 such as parameters, although you are not required to do so and will receive no extra credit for doing so. You may not use any Java constructs beyond Chapter 3.
g. Remember, your program will be graded both on “external correctness” (whether your program compiles and produces exactly the expected outputs), and “internal design and style” (whether your source code follows the style guide).
h. Submit the final “SpaceNeedle.java” file (DO NOT change the file name) online.