Visual Basic Programming
Question1:
Write statements to accomplish each of the following tasks:
a. Display the value of element 6 of array numbers.
b. Using a For...Next statement, assign the value 8 to each of the five elements of one-dimensional Integer array values.
c. Total the 100 elements of floating-point array results.
d. Copy 11-element array source into the first portion of 34-element array sourceCopy.
e. Determine the smallest and largest values in 99-element floating-point array data.
Question 2:
(Telephone-Number Word Generator) Standard telephone keypads contain the digits zero through nine. The numbers two through nine each have three letters associated with them ( Fig. 7.29 ). Many people find it difficult to memorize phone numbers, so they use the correspondence between digits and letters to develop seven-letter words that correspond to their phone numbers. For example, a person whose telephone number is 686-2377 might use the correspondence indicated in Fig. 7.29 to develop the seven-letter word “NUMBERS.”Every seven-letter word corresponds to exactly one seven-digit telephone number. A restaurant wishing to increase its take out business could surely do so with the number 825-3688 (that is, “TAKEOUT”).
Fig. 7.29. Telephone keypad digits and letters.
|
Digit |
Letters |
|
2 |
A B C |
|
3 |
D E F |
|
4 |
G H I |
|
5 |
J K L |
|
6 |
M N O |
|
7 |
P R S |
|
8 |
T U V |
|
9 |
W X Y |
Every seven-letter phone number corresponds to many different seven-letter combinations. Unfortunately, most of these represent unrecognizable juxtapositions of letters. It’s possible, however, that the owner of a barbershop would be pleased to know that the shop’s telephone number, 424-7288, corresponds to “HAIRCUT.” A veterinarian with the phone number 738-2273 would be pleased to know that the number corresponds to the letters “PETCARE.” An automotive dealership would be pleased to know that the dealership number, 639-2277, corresponds to “NEWCARS.”
Write an application that allows the user to enter a seven-digit number in a TextBox, and displays every possible seven-letter word combination corresponding to that number in a multiple line scrollable TextBox when the user clicks the Generate Words button. There are 2,187 (37) such combinations. Avoid phone numbers with the digits 0 and 1.