SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
Arrays
Exercise:
Programming Projects
Question:15 | ISBN:9780321531346 | Edition: 7

Question

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.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

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'.