image provider

Put Data Amanuensis


Disclaimer

This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

This is a very easy project that even a rank beginner could tackle. In the PL/I language you can write PUT SKIP DATA (XLOW, XHIGH); and it will print out the values labeled e.g. XLOW=123.0 XHIGH=512.0 (There may also be some commas or semicolons in there. It has been 44 since I wrote any PL/I.)

To get the same effect in Java you must write:

// simulating PUT DATA in Java
out.println( "xlow=" + xlow + " xhigh=" + xhigh );

This is clumsy to write and hard to proofread. Further, if you rename the variables, the labels will not change to match.

Amanuensis Solution

Write an Applet where you can paste a list of variables to want to dump and it generates Java source for out.println to dump the variables out labeled. The programmer can then paste that expansion into his code. For bonus points, accept input like this:
// upper angle at (3) relative to x axis
double theta1 = Math.atan2( y3d - y1d, x1d - x3d );  // convert to y is up
// lower angle at (3) relative to x axis
double theta5 = Math.atan2( y3d - y5d, x5d - x3d );
// if  theta1 == -theta5, there would be no rotation needed.
// positive rotation is counterclockwise.
double rot = -( theta5 + theta1 ) / 2;

Extract just the variable names theta1, theta2 and rot. Ignore everything else. That way the programmer can just plop in a block of code or definitions in the general vicinity of the problem area. Getting an extra variable that is not really needed is no big problem.

Java 8

It may be possible to get this effect in Java 8 with a method, not requiring an amanuensis. This would require more skill.


This page is posted
on the web at:

http://mindprod.com/project/putdata.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\putdata.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[44.204.94.166]
You are visitor number