Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void makeGraph ( Function1D f )
- {
- double hi = f.valueAt(0);
- double lo = f.valueAt(0);
- int width = 0;
- for( int o = 0; o < MAXROWS; o++)
- {
- double n = f.valueAt(o);
- if(n > hi) hi = n;
- if(n < lo) lo = n;
- }
- for ( int i = 0 ; i < MAXROWS ; i++ )
- {
- System.out.printf("%5.1f %5.1f",(double)i,f.valueAt(i));
- double n = f.valueAt(i);
- if ( n < hi && n > lo) width = (int)(10* (f.valueAt(i))) + 28;
- if ( hi == n ) width = MAXWIDTH;
- if ( lo == n) width = 0;
- for ( int j = 0 ; j < width ; j++ ) System.out.print("+");
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement