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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7. Depreciation to a Salvage Value of 0. For tax purposes an item may be depreciated<br />

over a period of several years, n. With the straight-line method of depreciation,<br />

each year the item depreciates by 1/nth of its original value. With the<br />

double-declining-balance method of depreciation, each year the item depreciates<br />

by 2/nths of its value at the beginning of that year. (In the last year it is<br />

depreciated by its value at the beginning of the year.) Write a program that<br />

(a) Requests a description of the item, the year of purchase, the cost of the item,<br />

the number of years to be depreciated (estimated life), <strong>and</strong> the method of<br />

depreciation. The method of depreciation should be chosen by clicking one<br />

of two comm<strong>and</strong> buttons.<br />

(b) Displays a depreciation schedule for the item similar to the schedule shown<br />

in Figure 5-16.<br />

Description: <strong>Computer</strong><br />

Year of purchase: 1999<br />

Cost: $2000.00<br />

Estimated life: 5<br />

Method of depreciation: double-declining-balance<br />

Value at Amount Deprec Total Depreciation<br />

Year Beg of Yr During Year to End of Year<br />

1999 2,000.00 800.00 800.00<br />

2000 1,200.00 480.00 1,280.00<br />

2001 720.00 288.00 1,568.00<br />

2002 432.00 172.80 1,740.80<br />

2003 259.20 259.20 2,000.00<br />

FIGURE 5-16 Depreciation Schedule<br />

8. The Twelve Days of Christmas. Each year, Provident National Bank of Philadelphia<br />

publishes a Christmas price list. See Table 5.8. Write a program that<br />

requests an integer from 1 through 12 <strong>and</strong> then lists the gifts for that day along<br />

with that day’s cost. On the nth day, the n gifts are 1 partridge in a pear tree, 2<br />

turtle doves, . . . n of the nth item. The program also should give the total cost<br />

of all twelve days. As an example, Figure 5-17 shows the output in the picture<br />

box when the user enters 3.<br />

TABLE 5.8<br />

Christmas Price Index<br />

Item Cost Item Cost<br />

partridge in a pear tree 27.50 swan-a-swimming 1000.00<br />

turtle dove 25.00 maid-a-milking 4.25<br />

French hen 5.00 lady dancing 289.50<br />

calling bird 70.00 lord-a-leaping 292.50<br />

gold ring 60.00 piper piping 95.75<br />

geese-a-laying 25.00 drummer drumming 95.00<br />

The gifts for day 3 are<br />

1 partridge in a pear tree<br />

2 turtle doves<br />

3 French hens<br />

Cost: $92.50<br />

Total cost for the twelve days: $71,613.50<br />

FIGURE 5-17 Sample Output for <strong>Programming</strong> Project 8<br />

<strong>Programming</strong> Projects 157

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

Saved successfully!

Ooh no, something went wrong!