Practice creating, documenting, and testing classes based on a given public interface. More graphics and math practice. Practice formatting text.
switch Statement
on pp. 187-8 (in ed3, it's Advanced Topic 5.2 on pp. 197-198), and
Special Topic 5.3-Enumerated Types on p. 194 (in ed3, it's Advanced
Topic 5.3 on p. 204). In Eclipse, checkout the FundamentalDataTypes project.
SVN Repositories view to check out this project. for loop and the charAt() method of String, complete the four TODO items in the StringsAndChars class.
main() method of ScannerExample to print appropriate prompts for the user.
CubicPlot. Its constructor should take eight (yes, eight!) arguments:
The class should include a method drawOn(Graphics2D g) that plots the graph as detailed below. The classes CubicPlotViewer and PlotComponent are provided. In PlotComponent, uncomment the call of the CubicPlot’s constructor that we supplied to test your code.
top, left, width, and height.
String’s format() method and Graphics2D’s drawString() method to display the equation on the graph.
-width to width. Plot the graph by drawing a line from the previous point calculated to the next point. (You’ll have to calculate the first point outside the loop.) Be sure to shift your plot according to the required origin. You should also “flip” the y values when plotting so that the y-axis increases up the screen.
top, left, width, and height.
The figure below gives an example plot (without clipping, no bonus for me):
|
Remember, in all your code:
Here is the grading rubric for this assignment. |
Turn in your programming work by committing it to your SVN repository.