CSE 143 Homework 2. You have two weeks for Homework 2. To help you get started early, we have broken the homework into two pieces with the first due in a week, and the second due the following week. Remember, there are no late homeworks, so you must complete each part by its specified due date to be eligible for credit on that part. For this homework, you will need to carefully study the posted solution for homework 1. Do not be worried if the solution you turned in does not look at all like the posted solution. The point of the posted solution is not to show you what we expected for homework 1. Indeed, we offered few specific directions for how to implement homework 1, and your solution will not be graded against the posted solution. Rather, the point is to take advantage of the fact that you have already thought very hard about the challenges posed in the first homework, and use this chance to review and learn from someone else's solution. For the coding parts of homework 2, we expect that you will: - follow the style (coding, indentation, naming) that you see in the solution. - where specified, follow the implementation directions. For the written parts of homework 2, we expect that you will: - provide clear and convincing answers in your own words. PART 1. EVALUATING THE SOLUTION Due: Sat January 24 -- 11.59.59pm. 1. In your own words, what problem is being solved by the class Pump. 2. How did you solve the same problem in your solution? 3. What problem is InfiniteCanvas trying to solve? 4. Describe how you solved this same problem in your solution? 5. Why might making InfiniteCanvas a subtype of GWindow be a good idea? 6. What is the purpose of the Debug class? How could you have used this to make the last homework simpler to debug? Give at least two examples from your solution where you could have used this. 7. For each and every method in TimeSeriesGraph: what problem is the method solving? describe how you solved the same problem in your solution. 8. In the second part of this assignment, you will introduce support for displaying a moving average of tickers. The command line argument you will use is: -movingAverage n graphs a moving average over the last points, rather than each point's exact value. The "-movingAverage n" option, though, is unlike that which is supported by the existing Args class. a. in what way is it different? b. how would change the system to support this new kind of argument? c. show any new code that you need to write. 9. Explain how TimeSeriesGraph assigns colors to different time series. 10. What is the principle limitation of the color assignment strategy? 11. How would you remove this limitation? (You will need to look over the java.awt.Color class to understand how Colors are created.) 12. TimeSeriesGraph.java has no javadoc comments. Study the file to make sure you understand how it works. Then, following the style used in the rest of the program, and paying careful attention to the directions given in http://java.sun.com/j2se/javadoc/writingdoccomments/index.html, add the appropriate javadoc comments. 13. Using box-and-arrow notation, show the architecture of the posted solution. PART 2. NEW FEATURES Due Fri January 30th -- 11.59.59pm. Add these new features to the code base in the posted solutions. 1. Implement the -movingAverage feature. A good solution will inject an intemediate "moving-averager" somewhere between a Ticker and a TimeSeriesGraph, leaving the other (non Driver) components untouched. 2. Rewrite refixShapes inside InfiniteCanvas.java so that labels are fixed on the screen in rows along the top, rather than in columns across the left. 3. Modify the program so that it can draw an x-axis on the bottom and a y-axis along the left. Each axis should include value-labeled tick marks. Specifically there should be labels for the min and max points, as well some reasonable number of intermediate labeled tick marks. This new behavior should be enabled at the command line with a new flag "-showAxes". The bulk of your solution should be implemented in a new class called TickedTimeSeriesGraph that extends (inherits from) TimeSeriesGraph as appropriate. In addition to the code, for each new feature, create a short document that: 1. Describes how you implemented the feature. 2. Describes any shortcomings that your implementation may have. 3. Describes how the feature would have been implemented in the context of what you turned in for Homework 1. If you believe that the feature could not have been implemented, describe why. WHAT TO TURN IN - For week 1, turn in a zip file containing three parts: - One called "solutions" that contains your answers. - One called TimeSeriesGraph.java that contains your javadoc directives. - A directory called "newargs" that contains any files that you had to change/create in order to handle the new kind of command line argument. - For week 2, turn in in a single zip file that contains the following subdirectories: src -- put all your code here doc -- put all your javadoc here data -- put your data files here featureinfo -- put your writeups here GRADING CRITERIA Part 1: Part 1 is worth a maximum of 4 points. 4 points: demonstrates complete understanding of the posted solution and its relationsip to the one you turned in. 3 points: demonstrates good understanding of the posted solution and its relationsip to the one you turned in. 2 points: demonstrates some understanding of the posted solution and its relationsip to the one you turned in. 1 point: demonstrates almost no understanding of the posted solution and its relationsip to the one you turned in. 0 points: demonstrates no understanding of the posted solution and its relationsip to the one you turned in. Part 2: Part 2 is worth a maximum of four points. Each feature is worth 1 point and will be graded according to three criteria: A. Does it work? B. Is it cleanly implemented in a style consistent with the original code, and C. Does it come with a satisfactory "featureinfo" document? Each element is worth 1/3 of a point. In addition, you'll receive an extra point if you succeed in making all three features work.