From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_MSGID, SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ea6d7c6f01e33df1 X-Google-Attributes: gid103376,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: HELP! HELP Date: 1996/11/14 Message-ID: <56dunv$g0t$1@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 196346339 references: organization: Comp Sci, RMIT, Melbourne, Australia nntp-posting-user: ok newsgroups: comp.lang.ada Date: 1996-11-14T00:00:00+00:00 List-Id: G SINGH POONIA 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.