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.

The Jones family has been selected as the<br />

first family on Main Street to have the opportunity<br />

to purchase an Apex solar-powered flashlight. Due to limited<br />

supply, only 1000 of these amazing inventions will be available<br />

in the entire state of Alaska. Don't delay. Order today.<br />

Sincerely,<br />

Cuthbert J. Twillie<br />

4. At the end of each month, a credit card company constructs the table in Figure<br />

2-32 to summarize the status of the accounts. Write a program to produce this<br />

table. The first four pieces of information for each account should be read from<br />

a data file. The program should compute the finance charges (1.5 percent of the<br />

unpaid past due amount) <strong>and</strong> the current amount due. Format the last column to<br />

be aligned right.<br />

FIGURE 2-32 Status of Credit Card Accounts<br />

5. Table 2-11 gives the distribution of the U.S. population (in thous<strong>and</strong>s) by age<br />

group <strong>and</strong> sex. Write a program to produce the table shown in Figure 2-33. For<br />

each age group, the column labeled %Males gives the percentage of the people<br />

in that age group that are male, similarly for the column labeled %Females. The<br />

last column gives the percentage of the total population in each age group.<br />

Note: Store the information in Table 2-11 in a data file. For instance, the first<br />

line in the file should be “Under 20”, 39168, 37202. Read <strong>and</strong> add up the data<br />

once to obtain the total population, <strong>and</strong> then read the data again to produce the<br />

table.)<br />

TABLE 2-11<br />

U.S. Resident Population in Thous<strong>and</strong>s (1996)<br />

Age Group Males Females<br />

Under 20 39,168 37,202<br />

20–64 76,761 78,291<br />

Over 64 13,881 19,980<br />

U.S. Population (in thous<strong>and</strong>s)<br />

Age group Males Females %Males %Females %Total<br />

Under 20 39,168 37,202 51.29% 48.71% 28.79%<br />

20-64 76,761 78,291 49.51% 50.49% 58.45%<br />

Over 64 13,881 19,980 40.99% 59.01% 12.76%<br />

FIGURE 2-33 Output of <strong>Programming</strong> Project 5<br />

6. Write a program to convert a U.S. Customary System length in miles, yards,<br />

feet, <strong>and</strong> inches to a Metric System length in kilometers, meters, <strong>and</strong> centimeters.<br />

A sample run is shown in Figure 2-34. After the number of miles, yards,<br />

feet, <strong>and</strong> inches are read from the text boxes, the length should be converted<br />

entirely to inches <strong>and</strong> then divided by 39.37 to obtain the value in meters. The<br />

Int function should be used to break the total number of meters into a whole<br />

<strong>Programming</strong> Projects 69

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

Saved successfully!

Ooh no, something went wrong!