Concepts of Computing, Section II

Visual Basic Assignment

Back to course page.

Write a Visual Basic program. The program can be a modification of an existing program (from the book, the course notes, or some other source) but then you must show the original program also.

You will be evaluated on originality (creating new code, rather than just copying code from elsewhere) and correctness (using the VB language features correctly).

Here are some project ideas that involve modifying the example programs, or writing a new program using the same language features. For some examples, more than one project is suggested.

You can probably think of projects that are more fun than these.

Your evaluation will also be based on a short quiz. It will be similar to this practice quiz, but it will also cover material from the second lab session as well.


This event counter demonstrates command button and label controls, event subroutines, assignment statements and arithmetic.

Write a small hand calculator. Use command buttons for the number keys, the Enter key and the + key etc. Use a label to display the results. To make it easy at first, just provide a few keys (start with just the 1 key and a + key) and only provide single digit numbers. If you can get that working, add more numbers and operations, and try entering and calculating with numbers with multiple digits.

Hint: You may have to cope with the distinction between String and Integer data types. The Val function converts from String to Integer.

Flip, Traffic

The coin flipping simulation demonstrates random numbers and the If control structure, and the traffic light simulation demonstrates the shape control and the Case control structure.

Write a randomness checker generates a bunch of random numbers in the range zero to a hundred, and plots a histogram (vertical bar graph) showing how many numbers fell in the range 0 to 10, 11 to 19, ... , 90 to 100.

Hint: You may wish to use a loop to generate a lot of random numbers easily, as in the array search example.


The square root finder uses successive approximation to find a solution for the equation r2 = x (it finds r when x is given).

Modify the program to solve other equations. Can you find the cube root, where the equation is r3 = x? Can you find a better rule for improving the approximation? What about more complicated equations, with more than one term?


The array search program demonstrates arrays, For loops, and printing to forms. It generates an array full of random numbers, prints it, and finds the largest one.

Use the Format function to make the output look nicer: right-justify the columns on the form or ...

Modify the program to add up all the elements in the array. Or count all the even numbers. Or ...

Experiment with the size of the array. How long does it take to create and search the array if, instead of ten elements, it has a thousand? A million? How large can it be? You could make a table of the results, code it in HTML, and put it on your web page. You could put the code for the program on the page too.

Write a tiny spell checker. Create an array of strings (words) and see if a particular word occurs in the array.


The text processing program demonstrates reading, processing, and writing a text file.

Write a simple text-to-HTML translator. Read in an ordinary text file. Write it out with a well-formed HTML head and body. Replace blank lines with HTML paragraph tags. View the output in your browser.

Write an HTML table-of-contents generator. Read in an HTML file. Find all the lines with header tags. Write out an HTML page of links to the header entries in the first page.

Investigate performance. How long does it take to create and write out a thousand lines? A million? (Be sure to delete large files after you create them!)


The orbital physics simulator demonstrates coordinate system graphics, some physical laws, and numerical integration of a differential equation.

Plot a trail to make the shape of the orbit visible.

Change the laws of physics! What if gravity did not obey an inverse square law, but a simple inverse, or an inverse cube?

Add a second satellite (moon or planet). Model the gravitational force between the two satellites.

Model a different physical system. For example, model a billiard ball bouncing off the edges of a table.

Back to top

Jon Jacky,