Exercise 4: Plotting a Histogram (20%)




Document: Software Engineering 1: Lab Exercises

next Session 11: Week 22/23: Simulating an RC
up Session 10: Week 20/21: Letter Frequencies
gif Exercise 3: Statistics (20%)

Exercise 4: Plotting a Histogram (20%)

Finally: develop a further version of the program, which, instead of outputing the relative frequencies as numbers, outputs a histogram. This will be made up of lines of varying width (made up of asterisk characters) one line for each letter, from A to Z. The letter with the most occurrences should be scaled to give a line with, say, 60 *'s. Then the lines for all the others should be shorter in proportion. The display might look somewhat as follows:

 A *************
 B ******
 C **
 D ***
 E ********************
 F ******
 G *

- and so on.

Note that histograms would normally be plotted with the independent variable oriented vertically, whereas I have described an horizontal orientation here. If you have time, try to alter your program again, to yield a histogram with a vertical orientation (this is a substantially more challenging task).




Document: Software Engineering 1: Lab Exercises

next Session 11: Week 22/23: Simulating an RC
up Session 10: Week 20/21: Letter Frequencies
gif Exercise 3: Statistics (20%)



McMullin@eeng.dcu.ie
Tue Apr 30 14:15:37 GMT 1996