CSCI 2000B

Spring 1999

Assignment 9

Date: 3/18/99 Due: 3/24/99 20 points

Write, enter, run, debug, and get working a Visual Basic project to solve the following problem:

Forest Survey Project Part 1

Create a form to allow the user to enter data for a forest survey and save the data to disk.

The data to be entered on the form:

Date of the survey (month, day ,year); location of the forest; surveyor; number of points examined; choice of whether circumference or diameter measurements were taken; point number; and for each quadrant 1-4, the species, distance to the point and the circumference/diameter. The basal area should appear once the circumference or diameter is entered (basal area = C2/4 =d2/4). There should be buttons to move to the next point by storing the data last entered into the array(s) and clearing the data for the point off of the form; and to save the data to a file.

The file should have the following format when saved:

line 1 month, day, year

line 2 location

line 3 surveyor

line 4 number of points

for each point there will be four lines with point number, quadrant (1-4), species, distance and basal area

To write to a file, you will need to put a CommonDialog box on the form. The in the action procedure where you want to build the file, use the following skeleton code to write your code:

CommonDialog1.Filter = "Text Files (*.txt)|*.txt"

CommonDialog1.ShowSave

fn$=CommonDialog1.filename

Open Fn$ for Output As #n

Write #n, variables

Close #n

This opens a standard Windows 95 dialog box to save the file allowing the user to select a drive, folder and filename. The default extension for the file is txt .

Turn in a listing of your code and a 3.5 inch disk containing the project, form, and EXE file (MAKE filename.EXE under FILES). Write your name on the disk and the name of the EXE file. All assignments are due at the beginning of class with late assignments reduced by 10% per day, up to a maximum reduction of 50%.