COSC 1436 Lab 7
Purpose: This lab focuses on writing a C++ programs that uses structs.
Due: Section 2: Before class on March 19, Section 3: Before class on March 21
Requirements C++ Programs: You will be writing a C++ program for this lab that will use nested structs. You will be creating a program that creates a set of nested structs that stores data about a club and the club's members.
You have been asked to create a program to keep track of campus clubs and club members. This program needs to do the following:
- This program is to work with one or more campus clubs. You should ask the user how many club they want to store data for near the beginning of the program.
- For each club keep the name of the club, a list of club members, and the club officers (as a minimum the president, secretary, and treasurer). Officers must be members of the club and the same person can hold multiple positions.
- For each club member you need to know their name, address, phone, their birth date, the date they joined this club, and a list of interests (0 or more interests).
- All of this information is to be taken in from the keyboard and stored in memory (you can use data redirection to avoid repetitive retyping of the same material for development/testing, but the version you turn in must use keyboard input).
- After all data entry is complete, publish a report showing each club entered and its officers and members, including each member's interests.
- Your program needs to use at least two or more nested structs that you designed to store this information. I used three structs, one for each club, one for club members, and a third for dates.
- All string data is to be stored in cstrings. You may use fixed length cstrings, unless you would like to earn bonus credit for dynamically created cstrings (see below).
- You will receive bonus points for the following:
- If your program validates the dates and telephone numbers
- (15 points) Dates should be in a standard date format, for example for March 12, 2013, the program should accept the date in the format of 3/12/2012 and/or 20130312 (computer programmers love this format). Remember, having more than 12 months is always a problem, and February can have either 28 or 29 days, depending on whether it is a leap year.
- (10 points) Phone numbers should be validated as (999) 999-9999, where each 9 stands for any digit from 0 to 9. For example a proper phone number would be (361) 825-5687, an improper phone number would be 361-825-5689.
- (20 points) If your structs are dynamically created using pointers and all of your cstrings are pointers that are then filled with dynamically created strings
- (20 points) If you provide a way to add new clubs and/or additional members to clubs after initial data entry is complete. This does not mean you need to store the information to files, but just be able to add information to the information already stored in memory.
- (10 Points) Outstanding reports that are well formatted and informative
I recommend you program this lab in a sequence of small steps. First, design the structs and how you are going to store the data. I suggest you review this with TA/SIs before actual coding begins. Second, develop pseudocode for the program and key functions. Third, write the main function that will call the functions that fill the structs. Fourth, for each struct, write a function that fills that struct from the keyboard. Forth, write the code to display the information in the structs. Fifth, modify the code so the structs are stored in an array of structs. And finally, write the code for the report in a formatted screen output. Don't go to the next step until you have successfully completed each preliminary step.
This program will be used as a basis for later labs in the course. Building an inadequate and/or poorly designed program here, will cause you significant problems later on when you need to reuse/revise this code.
Prepare a lab report/documentation package. All of these items do not need to be in the same file or word document, but the main lab report file must reference each item by name. Make sure a digital copy of each item is on your CD-R. The lab report must includes the following information:
- Your Name
- Purpose of this program.
- Program psuedocode
- Data design document (your struct design)
- Program source code
- Program output
- How was this program tested
- What problems/successes did you have with this program?
- An estimate of how much time you spent working on this labYou will be submitting this lab via Blackboard, as demonstrated in class. You will need to zip your files together and then upload your zipped submission to Blackboard. Make sure you include the source code and the rest of the documentation package, but not the executable files. The source code for your programs, called lab07***.cpp. Put your initials where the 3 asterisks appear. This files must be ready to compile using the standard g++ compiler.
Here is a C++ style guide from Dr. Fernandez that should assist you in coding your program. Style guide.