Changes are in red.
1. To apply new-gained object oriented design principles, and
2. To exercise the use of classes.
For this project, I will require:
- Three, and only three classes as defined below,
- One of the classes will hold two arrays each sized 100.
- You may not use dynamic data.
- You must submit a software engineering design document BEFORE beginning work on any coding.
- You must use at least 3 testing switches, named 1 2 and 3.
- At least 3 assert statements (more is suggested).
You will be implementing a console, command line based Multimedia Organizer. The basic idea is that your current Video, CD, DVD, cassette, etc collection should be able to be organized along with other students' collections so that we have a huge database of multimedia items that can be borrowed, traded, etc.
The first class you will create will hold student information. Each "student" should store that student's name, phone number, email address, street name with number, apartment letter and/or number, city, state, zip code, and other. (We will assume each student has standard U.S. addresses). Each student class should provide access functions to private data to update/view the information. Additionally, each student should be able to print to a stream (this will be explained in class) in the following format, where italics represent sample information:
Name:
Solomon S. Gifford
Phone Number:
(540) 555-1234
E-mail:
sgifford@vt.edu
Address:
1776 Liberty Lane
Apartment #25
Blacksburg, VA 24060
Other:
I am an Instructor...btw, my cell is (540) 555-4321.Please use whitespace before the data, and note that the telephone format is formatted by you. Leading spaces may either be multiple spaces or tabs, your call. Do not print an extra blank line before or after the data. In some cases, one or more fields will be left blank. In those cases, do not print the field heading. You can assume the email address will always be present. For example, if a student did not leave his phone number or address, his information would look as follows:
Name:
Solomon S. Gifford
E-mail:
sgifford@vt.edu
Other:
I am an Instructor...btw, my cell is (540) 555-4321.The second class will be a multimedia item. Each item will have a name, a type, an author, an owner (which will be a student email), a price, and a field indicating whether the item is one of the following: will sell, will rent, will trade, will lend, or none of the above. Each student class should provide access functions to private data to update/view the information. Additionally, each item should be able to print to a stream (this will be explained in class) in the following format, where italics represents sample information:
Item:
I Surrender All
Media Type:
CD
by:
Clay Crosse
Owner:
sgifford@vt.edu
Price:
$4.50
Availability:
Will RentAs with the student's data, please use whitespace before the data, and note that the price format should include the cents in two digits. Leading spaces may either be multiple spaces or tabs, your call. Do not print an extra blank line before or after the data. In some cases, one or more fields will be left blank. In those cases, do not print the field heading. You can assume the email address will always be present. Also, an item can only be added if a student with that email address exists. The only additional requirement is that your print method must provide the option to turn off printing of the Owner field.
You will then create a third class that will manage the first two classes by storing an array of students and an array of multimedia items. This class will initially (constructor, we'll learn this in class) open two files. The first will be a list of students with accompanying information named "students.data". The second file will be a list of multimedia items named "items.data". Additionally, this class will provide methods that implement the commands listed below. Note: you must only provide methods to implement the commands, not get the commands from the command file and not to parse the commands.
The commands will be read from a file named "commands.data" and will not be read nor parsed by the classes. All output will be written to a file named "output.data". Echo each command to the file and then display each command's output. The functions are as follows:
print students
- Print to the file all students in the order they were added to the array. A single endline should be added after each student.
print items
- Print all items in the order they were added to the array. A single endline should be added after each item.
print <emailaddress>
- Where emailaddress is a students email address. This should first print the student's data and then all items s/he has. Do NOT print his/her email address again for each item. A single endline should be added after the student's data has been written.
add item
@Item:
I Surrender All
@Media Type:
CD
@by:
Clay Crosse
@Owner:
sgifford@vt.edu
@Price:
$4.50
@Availability:
Will Rent
@@
- Notice that this command takes more than one line to complete. Also, all lines are optional except for the email address. If you reach the @@ line without finding an email address (in other words, the "@Owner:" line followed by a line with text...you don't have to check to make sure the email is in the correct format) simply discard the addition.
- The item will be added to the FIRST EMPTY array position.
- Print "Success" or "Failure" to the output file depending on the result of the add. Put it on the line after the command and then another endline.
- Note: an item can only be added if a student with that email address exists.
add student
@Name:
Solomon S. Gifford
@Phone Number:
(540) 555-1234
@E-mail:
sgifford@vt.edu
@Address Line 1:
1776 Liberty Lane
@Address Line 2:
Apartment #25
@City:
Blacksburg
@State:
VA
@Zipcode:
24060
@Other:
I am an Instructor...btw, my cell is (540) 555-4321.
@@
- Notice that this command takes more than one line to complete. Also, all lines are optional except for the email address. If you reach the @@ line without finding an email address (in other words, the "@E-mail:" line followed by a line with text...you don't have to check to make sure the email is in the correct format) simply discard the addition.
- The student will be added to the FIRST EMPTY array position.
- Print "Success" or "Failure" to the output file depending on the result of the add. Put it on the line after the command and then another endline.
delete <emailaddress>
- Where emailaddress is a students email address. This will require you to search BOTH the array of students and the array of items, deleting any student or item with that email address. Since your arrays are not dynamic, you won't be able to just delete the array position. You can either set the contents to default values or you can add a field to your classes to indicate that the item has been deleted.
- Note: notice that this will leave "holes" in the arrays where students or items have been deleted. Don't forget when adding an item or student to an array that since these are "deleted" they can be filled first before adding to the end of the data in the arrays.
- Print "Success" or "Failure" to the output file depending on the result of the delete. Put it on the line after the command and then another endline.
quit
- exits your program
- don't forget to close your filestreams
As with all programming projects in this course, please see http://courses.cs.vt.edu/~cs1704/summer2003/standards.htm for a list of requirements that apply to all projects. YOU WILL BE GRADED on these. In addition, include the following pledge at the bottom of your file:
On my honor:
- I have not discussed the C++ language code in my program with anyone other than my instructor or the teaching assistants assigned to this course.
- I have not used C++ language code obtained from another student, or any other unauthorized source, either modified or unmodified.
- If any C++ language code or documentation used in my program was obtained from another source, such as a textbook or course notes, that has been clearly noted with a proper citation in the comments of my program.
- I have not designed this program in such a way as to defeat or interfere with the normal operation of the Curator System.
<Your Name>
Name your file <yourpid>.cpp before 12:00 midnight of Wednesday, July 16, 2003. To receive credit, your assignment must be submitted before the time and date listed above. The curator can only accept a limited number of submissions per minute, so curator lag is not an excuse for submitting late. It is your responsibility to successfully submit your assignment via the curator, so plan to submit early. A maximum of five submissions is allowed per student, so DO NOT USE THE CURATOR FOR TESTING! Only the final submission will be graded, not your highest grade. In addition, 2 points will be added for every day early your last/graded submission was turned in for a max of 10 points.
Submit to: http://www.cs.vt.edu/curator/