|
|
Objectives Addressed
Overview
The purpose of this lab is to gain experience with the adapter pattern. Problem Statement
You should add open and save member functions for the DesktopItem and derived classes from Lab 1. You can copy and paste the implementations of the three classes from this file. The open and save functions should read and write the contents to files on the hard drive using file streams. Rather than actually creating a directory structure on the hard disk, you should save all files in the same directory. Files that are contained in folders will be saved by prepending the folder name and a comma to the filename. For example, if you have a folder called labs with two files called lab1.txt and lab1.wav in it, you should save the list of filenames in lab, the contents of lab1.txt in a file called labs,lab1.txt, and lab1.wav in a file called labs,lab1.wav. Also, you should not allow standard filenames to contain commas (you should modify the class implementations to prevent this). Create a Wav class that adapts the .wav file reading code found here. Your class should work with the Folder class from Lab 1. In addition, you should write a program that will read at least one of each file type and place each file type in a newly create a folder. The program should then display to the console the file size of the folder and the size of each file, and save the folder (which should save all of the files in the folder). Lab report (due 11:00pm, the day prior to week 4 lab)
Here is a template file to use as a starting point for this report. The lab report should consist of the following:
As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the XML help video and/or sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. Acknowledgment
This laboratory was developed by Dr. Chris Taylor. |
| © 2001-2007 Dr. Christopher C. Taylor | Office: CC-36C | Phone: 277-7339 |