Visual Basic Assignment #4
due April 30, 1999

This page has been visited times since April 15, 1999.

What new topics are covered in this assignment?

 

Description of Assignment #4

The purpose of this assignment is to learn how to use multilevel If/Else statements.

The program you will create for this assignment is a travel planner. It is not the best travel planner, since it only has 2 questions and 4 destinations. However, it serves the purpose.

You should make your program identical to mine. Take special care to make your message boxes exactly like mine. This means the title, message, buttons, and message icon must be the same as mine. Since we have only two questions, we are limited to four destinations. That is because there are four different combinations of answers: [yes, yes], [yes,no], [no,yes], and [no,no].

For those of you interested, 3 questions would have 8 combinations of answers, 4 would have 16, 5 would have 32, etc. As you can see if we asked N questions we would have 2 to the power of N possible combinations of answers. So you see how a program like this could get quite large in a hurry.

The flow of the program is as follows:

When the user clicks the start button, the program begins.

All input and output is done using MessageBoxes.

First, you ask the two questions, saving the answers in two different variables.

Once you have the two responses, you decide on the destination depending on the value of the answer variables. Remember that the value of these variables will be either vbYes or vbNo. I have put part of the required if/else construct below to help you out.

Once you have the destination, you print it out in the output message box. Notice that this message box has an information icon instead of a question mark.

Partial if/else construct

This is the if/else construct you need to make your decision. Note that I have intentionally left out several sections of code. These sections are shown using the [...] symbol. You will have to replace these sections with actual code in order for the program to work.

If (ans1 = vbYes) And (ans2 = vbYes) Then
destination = "Florida"
Else
If [...] Then
destination = [...]
Else
If [...] Then
destination = [...]
Else
destination = [...]
End If
End If
End If

 

There will be no exercise for this assignment, since it is quite straight forward. As always, you should read the pertinent parts of the textbook before doing the assignment. If you have any questions please email me. The executable of this assignment can be downloaded below.

Good luck.

Below are the assignment 4 downloads:

If you have Visual Basic 6 installed on your computer, download the Assignment #4 file only.

If you do not have Visual Basic 6 installed on your computer, you will need the Visual Basic 6 .dll files in addition to the assignment #4 file. The .dll download below is the same one used for assignments 1, 2, and 3 so if you already downloaded it, you will not need to download it again. Simply use the same files. Otherwise download both the Assignment #4 file and the Assignment 4 required .dll files below. To run, place all files in the same directory and double-click on vacation.exe.

Assignment #4 file (4,000 bytes)

Assignment 4 required .dll files (1.3 million bytes)

 

Go back to my main page

Go to Winzip's home page

To e-mail me click here

Page created and maintained by Ron Patterson