Plotting functions
No. 167
A simple character based plotting application
Q: |
Implement a class to plot e.g. ****** ** ** * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * ** ** ****** |
A: |
The current solution is not yet very flexible: The intended
plot function is hard coded within the
static void plotSine() {
init();
for (int xTics = 0; xTics < numTicsX; xTics++) {
double x = xMin + xTics * xStepWidth;
double sinOfX = Math.sin(x);
...
}
} You'll find a more sophisticated approach using interfaces in upcoming the section called “An interface based plotter”. |