Import JJIO Class SidePlot -- Name jmotil -- Does Side plot of function y vs x, with y horizontal Routine plotter (none) is public Boxes x, y ofType real Boxes iX, iY ofType int -- Does show outRow routine used to plot horizontally Start Outputln "0123456789012345678901234567890123456789" Set x = 0.0 Repeat ExitOn (x > 7.0) Set y = x * x -- y = f (x) Set iY = RealToInt (y + 0.5) -- round off y Call outRow with ( iY, " " ) -- row of blanks Outputln "*" -- make any mark Set x = x + 0.5 -- take new step EndRepeat EndRoutine plotter Routine outRow (times, mark) is public Slot times ofType int Slot mark ofClass Str -- Does: print mark any number of times Repeat ExitOn (times <= 0) Output mark Dec times by 1 EndRepeat EndRoutine outRow EndClass SidePlot A typical output (ultimately) Enter first value 0.0 Enter a last value 7.0 Enter the step size 0.5 Enter scale factor 1.0 Enter shift amount 0.0 Enter the plot mark 0 Enter the max of y 50.0 Plot y = x*x x y +--------------------------------------------------+ 0.00 0.00 |0 | 0.50 0.25 |0 | 1.00 1.00 | 0 | 1.50 2.25 | 0 | 2.00 4.00 | 0 | 2.50 6.25 | 0 | 3.00 9.00 | 0 | 3.50 12.25 | 0 | 4.00 16.00 | 0 | 4.50 20.25 | 0 | 5.00 25.00 | 0 | 5.50 30.25 | 0 | 6.00 36.00 | 0 | 6.50 42.25 | 0 | 7.00 49.00 | 0| +- - - - - + - - - - + - - - - + - - - - + - - - - + 012345678901234567890123456789012345678901234567890