CS 230 Fall 2009
Assignment 11 – Arrays (and what went before) -- Extreme
Photoshopping with the Stars!
100 Assignment Points
Assigned: 11/23/2009
Due: 12/07/2009 at the start of class This
includes two labs. However, if you leave campus before the lab on 11/24, that
is not an excuse for a late program.
Pre-Lab (Do Before Lab): Bring materials – a way to
save a copy for you and a copy to turn in. Read through the whole assignment;
hints and details are spelled out throughout. Plan out tasks, objects, and
events needed for program. Plan out major pseudocode.
Main Assignment Description:
The LSUNBC TV network is planning a new TV show in which
a celebrity and a regular person work together to ‘photoshop’ a picture of the
star to make them look better. Each team will be judged by a panel of up to 10
judges. LSUNBC needs a program to calculate the contestants’ scores during the
show. The program first obtains from the user via the GUI the name of the
contestant, then reads the contestant’s scores from the file named
contestantname.txt (i.e. if the contestant’s name is ‘wilson’, the scores will
be in a file named ‘wilson.txt’). If any line of the file includes invalid data
(non-numeric, not a whole number, or outside the allowable range (0-10)), then
a message should be displayed and no results be displayed. Valid scores
should be put into an array, since we will need to go back and revisit those
scores. Then, for the current contestant, the final score should be calculated
as a form of “Middle mean” in which the average of scores other than the
highest score and the lowest score is the result. Finally, if all inputs are
ok, then the program should display all judges scores from highest to lowest (in
a rich text box), the high score, the low score, the total of the values used
(i.e. without the max and min), and the middle mean.
Provide
the capability to:
·
Score a
contestant
·
clear (input
and outputs)
·
exit
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 11).
Background Knowledge:
·
Judges rating should be whole
numbers
·
No knowledge of
Photoshopping, TV shows, celebrities, etc is needed except as given here.
·
To help make clear the idea
of the middle mean, an example:
o Scores: 5,6,7,8,9,3,5,6,8,7
o Ordered Scores: 9 8 8 7 7 6 6 5 5 3
o Max: 9
o Min: 3
o Total without max and min: 52
o Middle Mean: 6.5
Task Details:
- We have covered procedures
and functions – I recommend that you continue to use them (e.g.
validation, reading from the file, finding the largest value, etc).
However, note that previous validation functions need to be adjusted since
the user cannot really be blamed for bad input values that are in a file.
- The user should just
be able to input the contestant’s name (they don’t know anything about
‘.txt’). Hint: in reading from a file, the file name isn’t anything more
than a String, so your program can easily take what is typed by the user
and adjust it to be the correct file name.
- If the correct file
doesn’t exist, just inform the user and don’t go on with any processing.
It could be because they mistyped the name or because the file doesn’t
exist, so don’t blame anybody.
- We cannot prompt for
users to deal with bad inputs from the file (e.g. a line in a file
contains rt, 5.5, -2, or 11), we can only inform them of the problem so
that they can fix the file. DO NOT try to continue and display results
if this happens.
- As a simplifying
assumption, we will not try to protect against too many or too few judges
scores in the file.
- I tried to make this
so that you NEED to store the scores in an array. Even if you figure out a
way to avoid using arrays, you must use arrays because this assignment is
about arrays.
- Do not try to load anything upon the start of the program (as we
have generally done with files). The user’s input determines what file
will be read.
- Unlike in examples done in class, only the calculate button needs to
access the array (and the number of values), so declare these local to the
event procedure rather than global. If you were to make these global then
once we started on a new contestant, the info from the preceding
contestant would need to be forgotten. So you really are doing yourself a
favor (along with “doing the right thing”) by defining the array locally.
DO pass the array (and number of values) to any
independent procedures or functions that need it.
- You must
use the filename scheme specified above, so I can easily test a bunch of
different programs in a row. Sample files will be provided on Blackboard.
In the spirit of thorough testing of programs, you should try other
versions of files as well.
- The only user entered
value is the contestant name. For validation, ensure that the name isn’t
empty and the file exists (as discussed above)
- We are only ever
dealing with one contestant at a time. Don’t try to keep track of more
than one contestant.
- The middle mean can be
a decimal.
- In some cases the
middle mean will be the same as the regular mean. Make sure when testing
that you are doing the middle mean correctly and not just when the middle
mean equals the regular mean.
- MAKE SURE YOUR PROGRAM
WORKS! (i.e. gets the correct answers) - it doesn’t have to just run, it
needs to run correctly! Now that our program is branching, we
need to try more examples to make sure that they work. We want all paths
through the program to work correctly. Think, “what different
possibilities need to be checked?”For instance, does your program do the
right thing when there are file errors?
Miscellaneous:
- You must turn on
Option Strict and Option Explicit
- 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.
- You MUST include
comments that explain your program in order to get full credit.
- Name all textboxes,
rich text boxes and buttons meaningfully, and use conventions for ending
their names. Also, any labels referred to in code should also be named
meaningfully.
- Any variables that you
declare should have meaningful names – descriptive of the data that they
hold.
- Make any textboxes and
rich text boxes that user should never enter a value in “Read Only” (or
use labels instead of textboxes!)
- 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. I will show you my bare bones prototype if you want, but I’m sure
you can improve on it.
Hand in:
- Compressed (zipped) folder with your entire project containing
all files related to the project, submitted to Blackboard. Please
name the zip file something along the lines of yournameAssignment11
- Print out of your code.