JORDAN UNIVERSITY OF SCIENCE AND TECHNOLOGY

CS 116 (Visual Basic 6)

Sections 1 and 2 (Dr. Monther Aldwairi)

Assignment # 3

Due Date 18/11/2007

 


Objective:

1.       To understand the use of repetition structures (Do…While and For…Next).

2.       To understand the use of files and EOF() function.

3.       To understand how to use format functions (Tab, FormatNumber, FormatPercent and Format).

 

 


Exercise 1:

 

Input

 

 

Your input is a file called “bachelor.txt”, located in the same folder as your “.vbp” and “.frm” files. It has the following line format:

 

String, Integer1, Integer2

 

Where,

String is the College Name

Integer1 is the number of degrees conferred in 1990

Integer2 is the number of degrees conferred in 2006

 

A sample test file is included below:

 

"Business and management", 184867, 226633

"Computer and info. science", 11154, 24768

"Education", 118038, 105233

"Engineering", 68893, 75157

"Social sciences", 103662, 124891

 

 

 

 

Interface

 

 

Write a VB program to produce the form in Fig.1.

 

 

Fig. 1. Interface

 

 

Note the following:

·         Buttons font is bold, “MS San Serif”,  size 8

·         The picture box font is "Courier New" size 8

·         Use proper naming standards

 

 

Functionality

 

  1. “Table of degrees” will read the records from the file and display a table that shows the number of degrees conferred in 1990 and 2006 as shown in Fig.2

 

  1. “Percentage changes” will read the records from the file and display a table that shows the percentage changes of the number of degrees conferred between 1990 and 2006 as shown in Fig.3

Percentage = (Degrees2006 –Degrees1990) / Degrees1990) * 100

 

  1. “Histogram” will read the records from the file and display a table that shows Histogram of degrees conferred in 2006 Fig.4.

The number of starts is determined by the Integer division of Degrees2006 by 10000

 

  1. Quit will terminate the program execution

 

 

Fig. 2. Degrees Conferred

 

 

Fig. 3. Percentage changes of the number of degrees conferred

 

 

Fig. 4 Histogram of degrees conferred in 2006

 

 

Note the following:

 

 

 

 

Hint: