CS 230 Fall 2006
Assignment 7 – Sub Procedures and Function Procedures
100 points
Assigned: 10/18/2006
Due: 10/25/2006 at the start of class
Pre-Lab (Do Before Lab): Bring a new disk. Plan out
tasks, objects, and events needed for program. Plan out major pseudocode. Put
some thought into this. The more clever you are, the less code you will write
on this assignment.
Main Assignment:
In many
soccer competitions, a group of teams play each other (“round robin”), and
wins, losses and ties are tallied. The teams are ordered in standings based on
3 points for each win, 1 point for each tie, and 0 points for each loss
(similar but different from hockey). (This is the only knowledge of soccer that
you need). We’re going to implement a simplified program that will for 4 teams
in a group calculate the points for each team (the user must type in the number
of wins, losses, and ties for each team).
Provide
capabilities for 1) calculating the points for all teams, 2) clearing the wins,
losses, ties, and points for all teams, 3) clearing the above plus the team
names for all teams, and 4) quitting the program.
This
assignment is intentionally designed to reward use of procedures and functions
– they will save almost 75% of the code you might write without them. You must
write some sub procedures and function procedures for this assignment (and
use them!)
Hand in:
- Floppy disk with an entire folder containing all files
related to the project. Please set the name of the project to
something other than the default name (WindowsApplication1, …).
Use Windows to copy the whole folder, instead of trying to “Save As”.
- Print out of your code.
Miscellaneous:
- You must turn
on Option Explicit and Option Strict.
- For validation – all
entered numbers (wins, losses, and ties for all 4 teams) need to be whole
numbers between zero and six (use a symbolic constant rather than
embedding 6 in the program). Don’t write almost the same code 12 times!!
Write a function procedure and call it wherever needed.
- As part of the
simplification of this assignment, we are NOT going to worry about
"Cross-validation" - The total number of wins should equal the total number of losses; the total number of ties should be even - Don't worry about these.
- The calculation of
points is fairly simple, but it is needed 4 times. Write a function
procedure and call it where needed!
- Note: Procedures
cannot be written general enough to be used multiple times if they refer
to specific text boxes. Instead pass the textboxes’ text into a string parameter.
- MAKE SURE YOUR PROGRAM
WORKS! (i.e. gets the correct answers). Now that our program is branching
and looping, we need to try more examples to make sure they work. Think,
“what different possibilities need to be checked?” For each,
calculate the correct answer by hand and see if your program gets it!
- Put YOUR NAME, e-mail
address, date, and purpose of the program in comments at the beginning of
the program.
- You MUST include
comments that explain your program in order to get full credit.
- Remember to use
meaningful variable names, and indent to show the structure of the program
(VB usually does this correctly).
- Put your name on the form as a Label or as part of the form title.
- Try to use good user
interface design. Make clear what user needs to do and what the answers
mean.