CS 230 Spring 2007 Assignment 11
– Arrays 100 points
Assigned: 04/18/2007
Due: 04/27/2007 at the start of class (last
day of class)
Pre-Lab (Do Before Lab): Bring materials – a way to
save a copy for you and a copy to turn in. Plan out tasks, objects, and events
needed for program. Write pseudocode for the main buttons and for
functions / independent sub procedures.
.
Main Assignment:
·
You have been
recently hired by a professor to write a program to help figure out curves for
tests. The scores from the test should be read in from a file (scores.txt) and
displayed in a rich text box. These scores should be put into an array of
scores as they are read in, since we will need to go back and revisit those
scores. Provide buttons and text boxes for trying out a potential method for
determining the curve: Target Middle Mean = X (see below). Calculate a curve
using a target specified by the user (see below). Once the curve has been
determined, add it to all student scores, and display the updated scores in a second
rich text box. Also, display information relevant to the method – the max, min,
and middle mean, and the curve, plus the number of A’s, B’s, C’s, D’s, and F’s
(in this simplified program no +’s or –‘s) in read only text boxes.
·
Provide the curve calculation
capability, a clear capability, a clear all capability and an exit capability.
o
The difference between Clear
and Clear All is that the Clear All clears the results rich text box. Both
versions clear the target, max, min, middle mean, and number of A’s, B’s, C’s
etc
·
A sample interface is
provided on page 2. Don’t let that constrain your creativity. Use it to help
understand what I see as the inputs and outputs.
Hand in:
- Floppy disk or CD-R with an entire folder containing all
files related to the project (or e-mail with zipped attachment containing
all files related to the project).
- Please set the name of the project to something
other than the default name (WindowsApplication1, …). It is
helpful if you use a name that identifies you as well as the assignment
(e.g. yourlastname assignment 10).
- Use Windows to copy the whole folder, instead of trying
to “Save As”.
- Print out of your code.
Task Details:
- Test scores can
include decimals, so all variables related to scores (including array)
should be doubles.
- A middle mean is
defined (for the purpose of this assignment) as the mean of all values NOT
INCLUDING the highest and lowest.
- In calculating the
curve, enough points will be added to raise the middle mean to the target
– BUT, make sure you NEVER subtract points!
- E.g. Middle Mean =
75; Target = 80 – curve is 5
- E.g. Middle Mean =
85; Target = 82 – curve is 0
- Validation:
·
Ensure that the target is are
numeric, and the entered value is between 30 and 100. Don’t try to calculate
anything if bad data has been entered (display a message).
- You must
use the filename specified above, so I can easily test a bunch of
different programs in a row. Sample files are provided on the assignments
page of my www site. In the spirit of thorough testing of programs, you
should try other versions of files as well.
- We have covered
procedures and functions – I recommend that you continue to use them (e.g.
extracting a line of text from the text in a file, finding the largest
value, etc).
- You cannot add points
to the students’ scores until all students have been processed; that is
one reason why we NEED arrays for this assignment.
- For simplicity in your
first array assignment, we will not have any student names at all; the
scores file will only contain scores, no names.
- For simplicity, we
will assume that all test scores come from an accurate source, so will be
in the correct range (0-100) (if there had been a problem, we would have
to just ignore that score since we cannot re-prompt anybody fro a
correction)
- The array should be
large enough to handle a large class (100 students)
- MAKE SURE YOUR PROGRAM
WORKS! (i.e. gets the correct answers). It doesn’t have to just run, it
needs to always run correctly! It should correctly handle
anything the user does. Branching is important in this program, so make
sure to test on more than one case. Think
up some different examples to test the program on.
Miscellaneous
- You must turn on
Option Explicit and Option Strict.
- Put YOUR NAME, e-mail
address, date, and purpose of the program in comments at the beginning of
the program. The purpose should be what the program is supposed to do, not
the learning goals. Comments are indicated with a single quote (everything
after the single quote is only for humans)
- You MUST include
comments that explain your program in order to get full credit.
- Define numbers
(especially those that appear more than once and/or could change sometime
in the future) as named constants.
- Remember to use
meaningful variable names
- Remember to indent to
show the structure of the program (VB usually does this correctly).
- Name all textboxes, rich
text boxes, comboboxes, and buttons meaningfully, and use conventions for
starting their names.
- Make textboxes that
user should never enter a value in (results / outputs) “Read Only”.
- 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. Make error messages as clear and helpful as possible!