comp.lang.ada
 help / color / mirror / Atom feed
* Re: HELP! HELP
       [not found] <Pine.GSO.3.95.961107112056.23008C-100000@dcsun4.comp.brad.ac.uk>
@ 1996-11-14  0:00 ` Richard A. O'Keefe
  0 siblings, 0 replies; only message in thread
From: Richard A. O'Keefe @ 1996-11-14  0:00 UTC (permalink / raw)



G SINGH POONIA <gsinghpo@comp.brad.ac.uk> writes:

>CAN YOU HELP ME WITH THIS EXERCISE PLEASE:

>STATISTICS of the rainfall for a certain location have been collected for
>the last 20 years.write a program that reads in the info. for the 20 years
>and presents the resultsin the form of a histogram. assume the annual
>rainfall lies in the interval 0 to 3000.

Easy:
	(load "rainfall")
	(histogram Rainfall)

Oh, you didn't want it in Xlisp-Stat?  Well, you should have _said_.

Let me give you one extremely important piece of advice.
Start by working your way through the problem description, making
notes of things you _do_ understand and of things you _don't_.  Go
to your lecturer, tutor, teaching assistant, or whatever (tutorials
are the ideal time to do this) and ask for confirmation of the
points you think you understand and clarification of the ones you
don't.  Take notes.  Write up your detailed understanding of the
problem.  Do this first.

In this case, 
 - how do you know where to look for the info?
   Is it going to come in on the standard input stream?
   Is it going to be in a text file?  Which one?  How do you know that?
   Or is it going to be in a "binary" (Sequential_IO) file?

 - What is the format of the data?  Is there one number per line,
   a fixed number on each line, a variable number on each line?
   Are the spaces between the numbers, or commas, or slashes, or
   what?  Is there text to ignore at the beginning or end?

 - You know how many _years_ there are, but how many _measurements_
   are there?  Is rainfall recorded once per day? once per week? once
   per month?  once per quarter?  one per year?  What order are the
   measurements in?

 - YOU know there are 20 years' worth of data, but is the PROGRAM
   allowed to know that, or must it find out by itself?

 - Are there some test data sets you can use to test your program?
   Where are they?

 - What exactly are the values that you are to record in the
   histogram.  For example, is it possible that you might be required	
   to plot rainfall per *year*, given data recorded *per month*?

 - What _is_ a histogram anyway?  I know, but do you?

 - How are you supposed to draw the histogram?  By making calls to
   a graphics library like X?  By making calls to a more portable
   library such as Ada/Tk?  By using cursor movement commands on an
   ANSI-standard terminal?  By writing lines of '*' characters
   going _across_ the screen using plain Text_IO?  By writing lines
   of '*' characters going _up_ the screen using plain Text_IO?

 - is there an executable version of the model answer that you can
   run to compare your program with?

 - How much of the code must be original, and how much may you copy
   from other sources *with acknowledgements*?  (Copying without
   acknowlegement, e.g. using answers from the net without mentioning
   who gave them to you, is called "plagiarism", "cheating", "bad
   manners", and "bloody stupid".)

After that, a common scheme that people use is
  Input
  Process
  Output
In this case,
Input
 - how would you read the data in? and how would you store it?
   [There's a _reason_ why you have been promised a specific amount
   of data; it's to let you use a very simple data structure that is not
   really sufficient in "real life".]

Output
 - how would you draw a histogram, given freedom to design its
   input data structure?
   [Hint:  given a two dimensional array of characters, how
   would you write that to standard output?]

Process
 - how would you convert the data structure yielded by input
   into the data structure expected by output?

This too needs to be written down.

When you've sorted this out, it's time to start on your program.
START BY WRITING THE COMMENTS.
Don't forget to include your name and any student ID you may use.
I've just marked a batch of assignments half of which were missing this
information, and I can tell you it puts your marker in a bad mood.

When you've got the comments down, explaining your data structure
and methods (in English; not a paraphrase of the code!), write the
code, looking at the comments to remind yourself of how you intended to
do it and what the identifiers mean.

-- 
Mixed Member Proportional---a *great* way to vote!
Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-11-14  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.GSO.3.95.961107112056.23008C-100000@dcsun4.comp.brad.ac.uk>
1996-11-14  0:00 ` HELP! HELP Richard A. O'Keefe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox