[CSC 204] Re: CSC 204 Assignment 1
Andrew J. Pounds
pounds at theochem.mercer.edu
Mon Feb 2 06:12:36 EST 2009
> Your directions for assignment one are very vague and I cant quite
> understand exactly what the program is suppose to accomplish. It
> states that the program allows the user to enter two data points, but
> continues by implying that the y value for one of the data points that
> we supposably entered will be used to calculate the x value. I looked
> at the API for line.class but it was not specific enough for me to
> find out what is actually being calculated by the program and what is
> know. Does the forecastx, forecasty, getslope, and getyint simply
> return the value? Do we simply use setslope and setyint to contain
> the values shown on your sample run or is there some kind of
> calculations going on in that method? If there was some way for me to
> just view the line.class file as it was written as line.java file I
> could better understand how to achieve your desired output, but the
> .class file displays some abstract code that I do not understand.
> Thank You.
>
>
Did you look at the sample output on the web page. By calling the
class constructor with four data values ([x1,y1], [x2,y2]), you uniquely
define a line. As the API states, if you provide forecastY with an
argument that is an "x" value on the line, it will return the "y"
value. Likewise, if you give forecastX a "y" value argument, it will
return the "x" value. Similarly, once you call the constructor, you
can also return the value of the slope and Y-intercept using the
appropriate calls to the line.class. All I am doing in the line class
is playing around with the equation
y = mx + b
I just hid all of the math from you because the point at this stage of
the game is for you to become familiar with objects and using them. I
also included some "extra" pieces in the API that you don't even need.
There are two additional constructors and the methods setSlope and
setYInt will allow you to set the values of those entities (which
together also uniquely define a line). Please understand, a major point
of this lesson is for you NOT to have the line.java file. If you need
help using the line.class, please don't hesitate to contact me or even
send me snippets of code.
Don't fret -- math -- and lots of LOGIC loom on the horizon...
--
Andrew J. Pounds, Ph.D. (pounds at theochem.mercer.edu)
Associate Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://theochem.mercer.edu/pipermail/csc204/attachments/20090202/32e489ed/attachment.html
More information about the csc204
mailing list