19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

98 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

FIGURE 3-8 Sample Run for <strong>Programming</strong> Project 1<br />

2. About seven million notebook computers were sold during 1997. Table 3.2<br />

gives the market share for the four largest vendors. Write a program that displays<br />

the number of computers sold by each of the Big Four. The input <strong>and</strong> output<br />

should be h<strong>and</strong>led by Sub procedures <strong>and</strong> the number of computers<br />

calculated by a Function procedure.<br />

TABLE 3.2<br />

1997 Market Shares of the Top Notebook Vendors<br />

Source: PC Magazine, January 20, 1998.<br />

Company Market Share<br />

Toshiba 20%<br />

IBM 11%<br />

Compaq 9%<br />

Dell 6%<br />

3. Table 3.3 gives the advertising expenditures (in millions of dollars) for the four<br />

most advertised soft drink br<strong>and</strong>s during the first nine months of 1995 <strong>and</strong><br />

1996. Write a program that displays the percentage change in advertising for<br />

each br<strong>and</strong>. Sub procedures should be used for input <strong>and</strong> output <strong>and</strong> the percentage<br />

change should be computed with a Function procedure. Note: The percentage<br />

change is 100 * ([1996 expenditure] – [1995 expenditure]) / [1995<br />

expenditure].<br />

TABLE 3.3<br />

Most Advertised Soft Drinks<br />

Br<strong>and</strong> 1995 Expenditure 1996 Expenditure<br />

Coca-Cola classic 60.7 121.6<br />

Pepsi-Cola 94.8 83.0<br />

Diet Coke 43.7 70.0<br />

Dr. Pepper 46.3 51.8<br />

Source: Beverage World, March 1997.<br />

4. A fast-food vendor sells pizza slices ($1.25), fries ($1.00), <strong>and</strong> soft drinks<br />

($.75). Write a program to compute a customer’s bill. The program should<br />

request the quantity of each item ordered in a Sub procedure, calculate the total<br />

cost with a Function procedure, <strong>and</strong> use a Sub procedure to display an itemized<br />

bill. A sample output is shown in Figure 3-9.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!