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.

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

12. Functions can be thought of as accepting numbers or strings as input <strong>and</strong><br />

returning numbers or strings as output.<br />

Function Input Output<br />

Asc string number<br />

Chr number string<br />

InStr string, string number<br />

Int number number<br />

LCase string string<br />

Left string, number string<br />

Len string number<br />

Mid string, number, number string<br />

Right string,, number string<br />

Rnd number<br />

Round number, number number<br />

Sqr number number<br />

Str number string<br />

Trim string string<br />

UCase string string<br />

Val string number<br />

PROGRAMMING PROJECTS<br />

1. Write a program that allows the user to specify two numbers <strong>and</strong> then adds, subtracts,<br />

or multiplies them when the user clicks on the appropriate comm<strong>and</strong> button.<br />

The output should give the type of arithmetic performed <strong>and</strong> the result.<br />

2. Suppose automobile repair customers are billed at the rate of $35 per hour for<br />

labor. Also, costs for parts <strong>and</strong> supplies are subject to a 5 percent sales tax.<br />

Write a program to print out a simplified bill. The customer's name, the number<br />

of hours of labor, <strong>and</strong> the cost of parts <strong>and</strong> supplies should be entered into<br />

the program via text boxes. When a comm<strong>and</strong> button is clicked, the customer's<br />

name (indented) <strong>and</strong> the three costs should be displayed in a picture box, as<br />

shown in the sample run in Figure 2-31.<br />

FIGURE 2-31 Sample Run for <strong>Programming</strong> Project 2<br />

3. Write a program to generate the following personalized form letter. The person's<br />

name <strong>and</strong> address should be read from text boxes.<br />

Mr. John Jones<br />

123 Main Street<br />

Juneau, Alaska 99803<br />

Dear Mr. Jones,

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

Saved successfully!

Ooh no, something went wrong!