Consider a mail-order business in which customers get a discount based on the quantity they order. In writing a program to compute the discount based on a customer's order quantity, why is it not a good idea to construct an array with as many elements as a customer might want to order, and store the appropriate discount associated with each number?

What will be an ideal response?


This approach has at least three drawbacks:
• It requires a very large array that uses a lot of memory.
• You must store the same value repeatedly. For example, each of the first nine elements receives the same value, 0, and each of the next four elements receives the same value, 10.
• How do you know when you have enough array elements? Is a customer order quantity of 75 items enough? What if a customer orders 100 or 1,000 items? No matter how many elements you place in the array, there's always a chance that a customer will order more.

Computer Science & Information Technology

You might also like to view...

Although you can add toolbars to Windows Vista, you cannot add them to Internet Explorer

Indicate whether the statement is true or false

Computer Science & Information Technology

Match the following keys to their functions:

I. F11 II. F2 II. Tab IV. Home V. Esc A. moves insertion point right one field in the same row of a database B. moves insertion point to the first field in the current row of a database C. cancels any change made in a current field while in Edit mode D. toggles the Navigation Pane on and off E. switch to Edit mode

Computer Science & Information Technology

A superscalar processor can be best thought of as a pipelined processor where the pipeline is replicated; for example, a 4?way superscalar processor has four parallel pipelines allowing four instructions to be executed in parallel. True or false – and why?

What will be an ideal response?

Computer Science & Information Technology

/* this is a comment */ is not a valid C++ comment.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology