Exercises
Exercise 1 ------------------- AddressCreate an Address application that displays your name, city, and state in three separate labels. Theinterface should look similar to:
gI] Address ~]Q]Madison Hanna
51. Clair
Michigan
Exercise 2 -------------------Schoola) Create a School application that displays your school's name and mascot centered in
two separate labels. Choose a different font, style, and size for the school name. Theinterface should look similar to:
III School ~]Q]Program
Ivy UniversityFlorida Panther
b) Modify the School application to include a Program menu with an Exit command.
Exercise 3 Band
Create a Band application that displays the members of a selected band. Include at least three of yourfavorite bands. The interface should look similar to:
III Band Information 8lQ] 'X
5 elect a band
o Black Eyed Peas
o Korn
o Godsmack
o Linkin Park
o Metallica
James Hetfield· Vocals I Rhythm Guitar
\Lars Ulrich Drums I Percussion
Kirk Hammell, Lead Guitar
Robert Trujillo· Bass Guitar
- Chapter 2 Introducing Visual Basic
Exercise 4 SchoolInformationCreate a SchoolInformation application that displays the city and state of a selected school. Include atleast five of your favorite schools. The interface should look similar to:
~ School Information ~rg] 'x
S chooll nformation
o American University
o Harvard
<9 Michigan Slale University
o Princelon University
o Syracuse University
location:
Easl lansingMichigan
Exercise 5 ---------------AdditionPropertiesa) Create an AdditionProperties application that shows the associative property of addi
tion, (a + b) + c = a + (b + c), in a label. The interface should look similar to:
ljJ Addition Properties GJ§ X
(a + b) + c = a + (b + c)
b) Modify the AdditionProperties application to display the associative property of addition when one button is clicked and the commutative property, a + b = b + a, whenanother button is clicked. The interface should look similar to the following after clicking Commutative:
It] Addition Properties
a+b=b+a
[ Associative II C~;;:;mulal;;;~ ~
c) Modify the AdditionProperties application to include a Program menu with Associative,Commutative, and Exitcommands.
Chapter 2 Introducing Visual Basic -
Exercise 6 HelloAndGood-byea) Create a HelloAndGood-bye application that displays a label centered, bold, and size 18
that reads Hello! or Good-bye! depending on the button clicked. The interface shouldlook similar to the following after clicking Hello:
JjI Hello and Good-bye
Hello!r Hello II I Goodbye
b) Modify the HelloAndGood-bye application to include a Programmenu with Hello,Goodbye, and Exit commands.
Exercise 7 ---------------Circ1eCircumferencea) Create a CircleCircumference application that displays in a label the circumference (2m)
of a circle with radius 10. Use the value 3.14 for 1t. The interface should look similar to
the following after clicking Answer:
JjI Circle Circumference
What is the circumference of a circle with radius 107
~
Answer 62.8
b) Modify the CircleCircumference application to include a Program menu with an Exit
command.
Exercise 8 ---------- RectangleAreaAndPerimetera) Create a RectangleAreaAndPerimeter application that displays the area (length * width)
and perimeter (21+ 2w) of a rectangle of length 5 and width 3. The interface shouldlook similar to the following after clicking Answer:
~ Rectangle Area and Perimeter r;][gJL.8J
What is the area and perimeter of a rectangle with length 5 and width 37
Area = 15
Perimeter = 16 Answer
b) Modify the RectangleAreaAndPerimeter application to include a Program menu withan Exit command.
-- Chapter 2 Introducing Visual Basic
Exercise 9 LongJumpAveragea) Create a LongJumpAverage application that calculates and displays the average jump
length of an athlete whose jumps were 3.3m, 3.5m, 4.0m, and 3.0m. The interface shouldlook similar to the following after clicking Average:
~ Long Jump Average ~[Q]
~3.45
Program
What is the average jump length of a long·jumper whoseiumps were 3.3m. 35m. 4.0m. and 3.0m?
f, -- .1
b) Modify the LongJumpAverage application to include a Program menu with an Exitcommand.
Exercise 10 Position
Create a Position application that changes the position of text in a label according to the commandselected by the user. The application should include a Program menu with an Exit command anda Position menu with TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft,
BottomCenter, and BottomRight commands. The interface should look similar to the following afterselecting TopLeftfrom the Position menu:
~ Position GJfQ)(g)Program Position
HERE
Hints: Be sure the label is large enough to show changes in text position. Also, use the IntelliSense listfor selecting the assignment value for the TextAlign property.
Chapter 2 Introducing Visual Basic -