CS 230 Spring 2007 Assignment 8 & 9 –
A surprise “twist” to the project related to files added to the requirements
Revision Assigned: 03/28/2007
Due: 04/04/2007 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.
Revision to Main Assignment:
You are
adding three capabilities related to files to the previously described
paparazzi invasion (for previous description see http://www.lasalle.edu/~redmond/teach/230/Assignment8.htm )
·
A “Save Game”
capability – which writes the results rich text box contents to a file named
“results.txt” and writes the current number of paparazzi to a file named
“number.txt”. If either of the files already exist, display a message
instead of adding to or replacing the contents of the files!
·
A “Load Saved Game”
capability – which reads in the “results.txt” file, replacing anything in the
results rich text box with the contents of the file, and reads in the
“number.txt” file, replacing anything in the starting/current number of
paparazzi text box. If either of the files doesn’t exist, display a
message instead of trying to change things (don’t do a partial change
if one file exists and the other doesn’t)
·
A “Delete Saved Game”
capability – which deletes any existing “number.txt” and “results.txt” files.
Even if we haven’t covered this in class, it is easy! (look into my.computer.filesystem
capabilities)
Hand in:
- One Solution for combined Assignments 8 & 9. 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 8).
- Use Windows to copy the whole folder, instead of trying
to “Save As”.
- Print out of your code.
Task Details:
- Hint: Even though we are reading and writing
significant amounts of text from/to the results.txt file, the process
should be pretty short! We’re dealing with strings even though they are
big long strings with NewLines in the midst of them (i.e. we should be able
to write the results file in one write, without any looping!)
- Hint: Testing “Load” and “Delete” will be
easier after “Save” has already been written.
- You must use
the filenames specified above, so I can easily test a bunch of different
programs in a row.
- For other details, see
original description at http://www.lasalle.edu/~redmond/teach/230/Assignment8.htm
- MAKE SURE YOUR PROGRAM
WORKS! (i.e. gets the correct answers). It doesn’t have to just run, it
needs to run correctly! Try on various combinations of files
existing and not existing.
Miscellaneous – From
Before – Don’t Forget
- 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 futures) 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!