CS252. User Interface Design
Program 2 - I/O and Popup Dialogs
Due 11:59 PM, Monday, January 24
From this assignment on: Always include "Option Explicit" as the first line in
your code (see Comment #5 on p. 88). Also,
always create a new subdirectory for the files associated
with a new assignment, and always use a single project group for all parts of an assignment.
(The Schneider book does not give details about projects versus project groups, so
instructions are provided here.) The project group for this assignment should be called
Note that the description here should be treated as a "software
specification." Make sure you include exactly the features described.
Don't add any features unless you have discussed them with the TA first.
Part A: project "Prog2a"
For this part of the assignment, you will develop a graphical interface that solves
Exercise #43 on page 112.
Keep an eye on the Project Explorer window in the upper righthand part of the screen.
That's where most name changes will show up.
- Open a new project. Give the project the name "Prog2a" (instead of the default
name "Project1") by going to "Project->Project1 Properties" and typing in the new name.
- Change the name of the project's form from "Form1" to "frmProg2a".
- Save the project by going to "File->Save Project As". Although you will have to move
to your new assignment subdirectory, you won't have to type in the name of the project
and form, since you already furnished them.
- Create a program to solve Exercise #43 on page 112. The form should have a PictureBox
for displaying the change in student activity, plus a Command button that will activate
reading of the input and the display of output.
- Indicate the 1996 and 1997 levels that were read as input, as well as the change in
activity levels. Be sure to choose strings that make it clear what is being shown.
Part B: project "Prog2b"
In this part of the assignment, you will add a second project to form a "project group."
This version of the program will improve the appearance and behavior of the previous
Now you are ready to improve the program. Implement the following enhancements:
- Create a project group name by choosing "File->Save Project Group As". Use the
name "Program2" - and make sure it is being saved in the assignment subdirectory.
- Go to "File->Add Project" so you can add a new project. Note the changes to the
Project Explorer window. This time, change the names of the project and the form to
"Prog2b" and "frmProg2b".
- To speed things up, copy the objects you used for Prog2a into the new form for Prog2b.
Click on the Prog2a form to make it active. Go to "Edit->Select All", then "Edit->Copy".
Now click on the new Prog2b form and choose "Edit->Paste". The formatting may have gotten
messed up, but the object were copied.
- Improve the formatting using VB's "Format" menu. While all the objects are still
selected, choose "Format->Center in Form->Vertically"
and then "Format->Center in Form->Horizontally".
- You can also copy code into your new project. Copy in all the code you created for
- Change the Caption on frmProg2b so that you can tell which one is executing. Make
this caption be "More About xxxx" (where "xxxx" is whatever the Caption for
- Save this project by choosing "File->Save Project Group", which will save all the
new pieces. Note that you may have
to confirm the names of the Prog2b and frmProg2b - and make sure they are saved in the
- Run the program and look carefully at the caption on the form. Is this the new
program, or the old one? The problem is that whenever there are multiple projects in
a project group, VB runs the one that appears in boldface in the Project Explorer window.
To change to the newer project, click on the project line for Prog2b using the right
mouse button and select "Set as Start Up" from the pull-down menu. Prog2b should now be
boldfaced. When you choose "Run", the new form will appear.
In grading your program, we will use our own input files, each of which will have
exactly two lines (like the example shown for exercise #43). However, your solution must
work with a wide range of possible percentages. You should figure out what the upper and
lower bounds on these values are, and test your solution with appropriate input datasets.
- Instead of just reading the input from a particular file, add an InputBox that prompts
the user for the name of the file to use as input. (All files will be two lines in length
and use the format shown in the text.) Be sure that the prompt string is easy to
- To improve usability, make it possible for the user to name any file from the same
directory as the program, without having to provide a pathname (see bottom of p. 105).
- Make sure that the percentages always show just one decimal place (e.g., 86.7%),
regardless of how many were in the input file, or how many are calculated as the change.
- Use a subprocedure to generate the output. That is, input a set of values from the
file, then use those as arguments to a subprocedure that generates the output.
Turn in the whole project group as a single unit by using WinZip
(available on all the CS NT's) to package up the entire directory into a
single file for submission.