CS 230 Fall 2009
Assignment 9 – Files (and what went before) -- Personal Internet
Radio!
100 Assignment Points
Assigned: 11/09/2009
Due: 11/16/2009 at the start of class
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:
LaSalloogle
Labs is developing an online radio station in which you create your own
personal radio station and music is streamed to you based on what you like and
don’t like (like other services already out there). Your program is a
simplification dealing with ranking songs (only)..
·
The program
should at start up get from a file (songs.txt) a list of songs and display them
in a list box (or ComboBox).
·
When the user
selects a song from the song list box, the song information should be displayed
in a read-only text box or in a label. (This should be done via the default
event for the list box)
·
When a user
specifies a rating (0-5) AND selects a “Rate” button, write the rating (song
and rating) to a comma-delimited text file (see below) for later tabulation
(add it to those already in the file), and remove the song from the list box
of songs. (DO NOT have the rating recorded immediately upon selection in
case of inadvertent click).
Provide
the capability to:
·
Rate a song
·
clear (song
and rating), and
·
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 9).
Background Knowledge:
·
Ratings are whole numbers
·
Songs would typically include
title and artist (see songs.txt file provided on Blackboard), but any format
will work.
Task Details:
- We have covered
procedures and functions – I recommend that you continue to use them (e.g.
validation, reading from the file).
- Songs could be loaded into a List Box or a Combo Box. The commands
are the same. I believe that with a larger list of songs that a list box
is better for the user.
- To add a choice to a list box or combo box use: controlname.Items.Add(thechoice)
- The songs should be loaded upon the start of the program. The user
should not have to do anything for them to be loaded.
- 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 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 song rating. For validation, ensure when the rate button is
selected that the song has been filled in and a valid rating has been
entered.
- The song rating should
be validated when the “rate” button is clicked to ensure that it is a
number, and is between 0 and 5 (inclusive). Don’t try to go on if bad data
has been entered (display a message).
It
is recommended that the validation be done via calling a function!
- After the rate button
has been successfully recorded, give the listener some kind of
confirmation (e.g. a msgbox) and automatically clear the song and rating
choices.
- To remove an item from
a list box or combo box use: controlname.Items.Remove(thevaluetoremove)
- When you remove the
song from the song listbox, that will result automatically in a change to
the item selected property of the list box, triggering an event. Your
event procedure needs to protect against that crashing your program (the
selected item will be set to “nothing” which is a built in value – typing
it in (nothing) you should see it turn blue.
- 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 user 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.
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 yournameAssignment9
- Print out of your code.