March 12:
Question:
I need a little clarification on this paragraph:
"That class must include a toString method that has a return
that produces a
String equivalent to the following: return "high
temperature: " + high +
"\nlow temperature: " + low;
Your variable names may be
different from those
used above. This toString method must be used to print the
program output. "
I thought the output would be the day with the largest span
and the day with
the lowest span, and what the span is, is that what the
paragraph says?
because to me it seems like you just want the highest and
lowest
temperature... which doesn't make much sense... so i was
wondering.
Answer: Yes all I want are the temperatures for the two days, NOT
the temperature span or the number of the day. OK
that may not make total sense (to a meteorologist). For the moment just
think of its purpose as a 108 loops assignment.
Please follow the instructions from the assignment: "The output
is the high and low temperatures for the day with the
maximum span, followed by the high and low temperatures for the day with
the minimum span." And please use a toString method that includes the
following statement:
return "high temperature: " + high + "\nlow temperature: " +
low;
Question: Do I need to deal with blank lines?
Answer: No. There will not be blank lines in the test samples.
Also don't worry about punctuation immediately preceeding an a or an.
There will not be a test like the following: Here is 'a example.'
March 11:
Question: When I subtract two different (but apparently equal)
expressions,
I get a small difference. Why? and What do I do?
Answer: (This is what is called roundoff error. You will learn all
about it in the 270 course next year.) You may lose digits of precision
when doing operations because computers store a limited number of digits
and computers store values in binary even though
the values are entered in decimal form. We will test your program with
values of limited precision so this should not be a problem.
Question: I drove myself crazy
over this, until I discovered that Java thought that 1.3 - 1.0
is
*NOT* the same as 0.7 - 0.4 (it thinks the first is larger). I
read
the "hints and tips" on roundoff, but it doesn't seem to clear
this
up.
Answer: Obviously the two differences above are equal. Sorry, I am
not
surprised that you were going crazy. To fix this problem include and use
the
following method in the part of your program
that
updates the day with the minimum
temperature span and the day with the maximum temperature span.
March 6:
Question: Under Part A of Assignment 6 in the Details paragraph you
mentioned "There
are no prompts printed", does this mean you don't want a
method that will
prompt the user for the days of the month and the high and
low temperatures?
Answer: Your program will have no output other than the final
result. There will be no messages printed on the screen requesting input
from the user.
Further clarification to a question from March 5:
As it says in the assignment: "In
addition to your ArticleTester class you must
have a class that stores and corrects a line of text."
The intention is that your program reads a line of text, stores the line
of text in an
object,
corrects it in that object and prints the corrected line. Of course to
finish that line (if the line ends in an article) your program may have
to read
the next line.
Your program then goes on to store, correct and print the next line, etc.
March 5:
Question:
Can we store the months temperature data in an array and then compare?
Answer: No. Do your comparisons when you read a day's data then
there is
no need to waste space by storing all the data when all you need is to
store a few current
values.
Question:
What am I supposed to do in Part 2? I could store all the input in one
string.
Answer: No that is not the intention. Similar to the question
about Part A above do your processing as you go along. By storing all the
input in a single String you would probably lose the formating in the
original text.
As it says in the assignment: "In
addition to your ArticleTester class you must
have a class that stores and corrects a line of text."
The intention is that your program reads a line of text, stores the line
of text in an
object,
corrects it in that object and prints the corrected line. Of course to
finish that line (if the line ends in an article) your program may have
to read
the next line.
Your program then goes on to store, correct and print the next line, etc.