Redo (or do for the first time) Programming Project 18 from Chapter 6.
Your program should not be hard-coded to create a bar chart of exactly
four integers, but should be able to graph an array of up to 100 integers.
Scale the graph appropriately in the horizontal and vertical dimensions so
the bar chart fits within a 400 by 400 pixel area. You can impose the constraint
that all integers in the array are nonnegative. Use the sentinel value
of –1 to indicate the end of the values to draw in the bar chart. For example,
to create the bar chart with values 20, 40, 60, and 120, your program
would operate on the array:
a[0] = 20
a[1] = 40
a[2] = 60
a[3] = 120
a[4] = -1
Test your program by creating several bar charts with different values and
up to 100 entries and view the resulting SVG files to ensure that they are
drawn correctly.
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.