CSCI 240 Project

Student List

40 Points

Problem Statement

As an introductory assignment in object-oriented programming, implement a student list using class composition.

Requirements

Implement classes Date, Name, Address, Person and Student. You will notice that the built-in data types are undefined. You will need to decide between string, int, float, etc.

Date(month, day, year);

Name(first_name, middle_initial, last_name, suffix);

Address(address_line_1, address_line_2, city, state, zip_code);

Person(Name name, Address address, Date date_of_birth)

Student(Person person, Date anticipated_completion_date, gpa, credit_hours_completed)

Student(

first_name,

middle_initial,

last_name,

suffix,

address_line_1,

address_line_2,

city,

state,

zip_code,

date_of_birth month,

date_of_birth day,

date_of_birth year,

anticipated_completion_date month,

anticipated_completion_date day,

anticipated_completion_date year,

gpa,

credit_hours_completed);

Create in array of 50 students with fake data (not NPI), write a sort function that sorts the array in last_name, first_name order, and print the results to the console.

Figures 17.1, 17.2, 17.3 (6/e), 20.1, 20.2 and 20.3 (5/e) show the proper relationship between classes and clients. Classes Date, Name, Address, Person and Student will have h and cpp files. Classes will #include the classes they reference. For example, Name will #include “name.h”, Person will #include “person.h”, “name.h”, “address.h”, and “date.h”. Be sure to follow the example implementing #ifndef, #define and #endif.

The main program file is project2.cpp. This is the only cpp that does not have a corresponding h.

The two styles of Student constructors support two styles of client. The constructor that passes objects supports object-oriented clients that are aware of the Person, Address, Name and Date classes. The constructor that passes built-in data types supports encapsulation of the implementation of the Student class. The client just #includes Student.h and is unaware that Person, Address, Name and Date classes are used internally. You may use either style of Student constructor in your main function.

You are expected to follow normal object-oriented conventions outlined in the textbook. These include defining getter and setter functions like set_student() and get_person(). Parameterless constructors are required if the Student array is constructed with default values with setter functions used later to populate the data.

The report should print out all the student information in columns. It is okay if the report wraps. The report is viewed in an editor where the rows do not wrap.

See Appendix A for sample data if you do not want to make up your own.

Commenting

Please make sure that you include a comment header block in every source code file your upload. It must include the course number, section number, assignment title and your name.
You also have to comment your code on assignments you write (not project 1, which is just a copy). The comments should be in terms of requirements. Do not comment every line, but you can't turn in code with no comments, either. Generally, you have to comment each function at a minimum. Normally, you document the purpose of the function, inputs, outputs and assumptions.
Deliverables

Upload h and cpp files, and the report in text format, to Assignments 2 by 11:55 PM on its due date.

Last Revised: 6/24/2012 10:42 AM

6

Appendix

You are allowed to use whatever data you want for the students, as long as it is does not refer to real persons. You may use the following data, if you find it helpful.

string firstNames [] = {"Amanda", "Brian", "Chelsea", "David", "Ernie", "Fritz", "Genny",

"Harold", "Ingrid", "Joy", "Kevin", "Lindsay", "Manny", "Neil", "Olga", "Peter",

"Quincy", "Reginald", "Sammy", "Theresa", "Ursula", "Vincent", "Wendy", "Xavier",

"Yonnie", "Zebulon", "Arnie", "Bianca", "Christopher", "Dennis", "Ernest", "Frank",

"Gary", "Henry", "Isabella", "Jeremy", "Kurt", "Larry", "Mary", "Nick", "Oliver",

"Patty", "Quinn", "Randy", "Samantha", "Trent", "Urban", "Victor", "Wendell",

"Xandra"};

char middleInitials [] = {'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',

'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'A', 'B', 'C', 'D',

'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',

'V', 'W', 'X'};

string lastNames [] = {"Samuelson", "Trenton", "Underwood", "Vugo", "Wehneman", "Beech",

"Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson",

"Van Buren", "Harrison", "Tyler", "Polk", "Taylor", "Fillmore", "Pierce", "Buchanan",

"Lincoln", "Johnson", "Grant", "Hayes", "Garfield", "Arthur", "Cleveland", "Harrison",

"Cleveland", "McKinley", "Roosevelt", "Taft", "Wilson", "Harding", "Coolidge",

"Hoover", "Roosevelt", "Truman", "Eisenhower", "Kennedy", "Johnson", "Nixon", "Ford",

"Carter", "Reagan", "Bush", "Clinton", "Bush", "Obama"};

string suffixs [] = {"", "", "Jr.", "", "III", "", "", "", "", "", "", "II", "",

"", "", "", "", "Sr.", "", "", "", "", "", "Jr.", "Jr.", "", "", "II",

"", "", "", "", "", "", "Jr.", "", "", "", "", "", "", "", "II", "", "",

"", "", "", "", "Jr."};

string addressLine1s [] = {"5505 Camelot Drive", "5987 Woodridge Drive", "5803 Twin River Lane",

"5802 Twin River Lane", "12148 Springdale Lake Drive", "123 Main Street", "768 Georgetown Road",

"7945 Sit Road", "5739 Ullamcorper Avenue", "1410 Turpis Street", "7449 Vulputate Road",

"604 Penatibus Avenue", "3291 Integer Avenue", "7421 Malesuada Avenue", "628 Magna Avenue",

"4089 Arcu Road", "5118 Consectetuer Avenue", "5445 Magna Avenue", "6459 Tincidunt Road",

"481 Eel Street", "6375 Nec Street", "9759 Sit Street", "8180 Street Road", "7735 Pellen Drive",

"1677 Nunc Avenue", "2517 Nunc Avenue", "2847 Sodales Street", "6204 Diam Avenue",

"8160 Eu Street", "8837 Turpis Avenue", "7015 Nulla Street", "6936 Mauris Street",

"8658 Lorem Avenue", "1126 Mi Road", "4733 Amet Road", "4819 Eu Road", "1614 Vitae Street",

"4057 Volutpat Avenue", "9703 Elementum Road", "2896 Ullamcorper Avenue", "3201 Non Road",

"7440 Libero Road", "3137 Curabitur Avenue", "2148 Libero Street", "6612 Eu Street",

"5732 Integer Road", "2280 Vitae Street", "5997 Amet Road", "9458 Massa Street",

"7782 Nunc Road"};

string addressLine2s [] = {"", "", "", "Apt. 4", "Suite 1100", "", "", "", "", "P.O. Box 120",

"", "", "", "", "", "", "", "", "Apt. 10", "", "", "", "", "", "Suite 100", "", "", "",

"", "", "", "", "", "", "Room 1114", "", "", "", "", "", "", "", "", "", "", "", "", "",

"", "Apt. G"};

string cities [] = {"Vernon", "Chesapeaker", "Erie", "Dodge City", "Chandler", "Ventura",

"Los Alamitos", "Oklahoma City", "Muskogee", "Williamsburg", "Inglewood", "South Pasadena",

"Kankakee", "Hot Springs", "Benton Harbor", "Sioux Falls", "Frederiksted", "Bessemer", "Chandler",

"Mesquite", "South Portland", "Salem", "Morgan City", "Worland", "Yonkers", "Baltimore",

"Lynn", "Chicago", "Long Beach", "Charlottesville", "Midland", "Litteton", "Taylorsville", "Salinas",

"Glen Cove", "Westfield", "Stanton", "Kettering", "Green River", "Norfolk", "Macomb", "Mason City",

"Racine", "Areceibo", "Ponce", "Redding", "Salt Lake City", "Boise", "Albany", "Salinas"};

// I used generated states off of the semi-plausible fake information site

string states [] = {"ID", "IL", "WY", "UT", "SD", "IA", "RI", "FL", "MN", "NJ", "MD", "UT", "WY", "AK", "SC",

"WV", "NE", "OK", "SD", "CT", "CA", "ME", "GA", "WI", "PA", "VT", "MO", "WV", "NM", "VT", "MI", "VA",

"VT", "TN", "MO", "DE", "NM", "AK", "UT", "VT", "TN", "CO", "HI", "MN", "KY", "ME", "UT", "ID", "ME",

"IN"};

string zipCodes [] = {"38046", "36959", "99890", "72399", "31630", "69307", "85162", "03404", "28130", "13937",

"15238", "91910", "67309", "84394", "70238", "33393", "91067", "80588", "68444", "94894", "02186", "82759",

"62091", "55069", "29736", "99173", "51808", "35065", "83048", "87079", "06091", "72060", "70063", "78818",

"59393", "21220", "58145", "66045", "49255", "21044", "50422", "19990", "59635", "10617", "93903", "74607",

"20082", "21061", "08533", "49069"};

int birthMonths [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5,

6, 7, 8, 9, 10, 11, 12, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 5, 6};

int birthDays [] = {15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 3, 2, 1, 28, 27, 26, 25, 24, 23, 22, 21,

20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,

15, 16, 17, 18};

int birthYears [] = {1980, 1979, 1976, 1984, 1985, 1983, 1980, 1979, 1976, 1984, 1985, 1983, 1980, 1979, 1976, 1984,

1980, 1979, 1976, 1984, 1985, 1983, 1980, 1979, 1976, 1984, 1985, 1983, 1981, 1982, 1970, 1984, 1985, 1986, 1987,

1988, 1989, 1984, 1985, 1986, 1987, 1988, 1989, 1979, 1980, 1981, 1982, 1983, 1984, 1985};

int completionMonths [] = {12, 5, 5, 8, 5, 12, 5, 5, 8, 5, 12, 5, 5, 8, 5, 12, 5, 5, 8, 5, 12, 5, 5, 8, 5, 12, 5, 5, 8, 5,

12, 5, 5, 8, 5, 12, 5, 5, 8, 5, 12, 5, 5, 8, 5, 12, 5, 5, 8, 5};

int completionDays [] = {15, 25, 25, 10, 25, 15, 25, 25, 10, 25, 15, 25, 25, 10, 25, 15, 25, 25, 10, 25, 15, 25, 25, 10,

25, 15, 25, 25, 10, 25, 15, 25, 25, 10, 25, 15, 25, 25, 10, 25, 15, 25, 25, 10, 25, 15, 25, 25, 10, 25};

int completionYears [] = {2010, 2011, 2012, 2010, 2011, 2010, 2011, 2012, 2010, 2011, 2010, 2011, 2012, 2010, 2011,

2010, 2011, 2012, 2010, 2011, 2010, 2011, 2012, 2010, 2011, 2010, 2011, 2012, 2010, 2011, 2010, 2011, 2012,

2010, 2011, 2010, 2011, 2012, 2010, 2011, 2010, 2011, 2012, 2010, 2011, 2010, 2011, 2012, 2010, 2011};

float GPAs [] = {4.0, 3.5, 3.6, 2.8, 2.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.8, 2.7, 3.0, 3.1, 3.2,

3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.0, 3.5, 3.6, 2.8, 2.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9,

2.8, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4};

int creditHoursDone [] = {20, 85, 66, 45, 37, 34, 67, 54, 55, 38, 78, 20, 85, 66, 45, 37, 34, 67, 54, 55, 38, 78,

20, 85, 66, 45, 37, 34, 67, 54, 55, 38, 78, 20, 85, 66, 45, 37, 34, 67, 54, 55, 38, 78, 20, 85, 66, 45, 37,

34};

6