Lab #4 Assignment

CSE 1320-001

Fall 2010

 

Due Date:        Lab #4 is due absolutely no later than 8:00pm Thursday, Dec. 9th

            Extra Credit for early submission as follows:

                        Turned in before 11:59pm Wednesday, Dec.8th Ð     16 extra points

                        Turned in before 11:59pm Tuesday, Dec.7th Р         24 extra points

                        Turned in before 11:59pm Monday, Dec.6th Ð          32 extra points

(see instructions on website for how to turn this in - Òlab submission infoÓ)

Grade value:    10% out of 100% for all grades

 

Objective:  The goal for this lab is to provide an opportunity for practice of C++ object development and the C++ programming topics and further analysis and design skills.  It is assumed that the students can use all the concepts in the C++ chapters.  This assignment is designed to practice those concepts by creating a C++ program.    

 

Every lab assignment allows students to practice program development, debugging, and testing.  All of these skills are crucial to success in Dr. TÕs class.  As you work on this lab assignment you are encouraged to ask the instructor or TA about any concepts you are unsure of. 

 

Topics: 

            C++

            Classes           

                        Objects

                        Methods

            Data encapsulation

            Accessor and mutator functions

            Constructors and destructors

            Display/print functions

            Internal calculation functions

            Multiple files for class, function, and main definitions

            Conditional compilation

 

Plan:  Dr. T gives an overall problem that students work on all semester.  Each lab assignment implements specific concepts.  Succeeding assignments will modify and extend previous assignments. 

 

Overview:  You are going to put together a small database of information about certain people.  You are going to get information from the user and store that information in a certain way.  WeÕll call this the data-entry phase of the program.  Once all the input data is entered, your program will allow another user to perform various tasks on the data by choosing tasks from a menu.  WeÕll call this the menu-driven phase of the program.  The user can continue to choose tasks from the menu as long as desired and one of the menu choices must be to end the program.  The program ends correctly when the user chooses that option.

 

You are also required to design your program in advance before you begin writing code.  You will document your design and turn in the design document at least a week before the lab assignment is due.  The goal of the design document is to assist you in developing the actual program.

 

This assignment has an overview section, a task description section, an implementation requirements section, a grading scale, and a deductions section.  If there is additional info needed it will be in a miscellaneous section at the end of this lab assignment.  Read ALL of the assignment before you start trying to develop the program.   

 

This lab assignment looks similar to the previous assignment but it has many differences.  Read it carefully and do not assume that everything from the previous lab is the same this time.

 

Be sure to check the DEDUCTIONS section at the end of this assignment to avoid penalties.  You may NOT use global variables, the exit command, goto, break (except in a switch), or continue. You may  NOT use C++ container classes for this lab.

 

Assumptions for the lab #4:

1) A  minimum of 12 people will be in the database.  Use constants to define the min values.  There is no maximum for Lab #4.

2) Title strings will have multiple words and blanks and no maximum length will be given.

 

 

Problem:  The people in your database will be speakers, performers, and entertainers who come to the UT Arlington campus in the 2010-2011 school year.  These will include the speakers in the Maverick Speaker Series, such as Bill Nye, the Science Guy, and speakers in the Engineering Speaker Series.  This will also include performers brought in by EXCEL and other campus groups.  As part of this assignment you will have to find this information on the UTA website to use as test data input to your program.

 

In lab #4 you are going to be looking at and manipulating your speaker data from an object-oriented perspective. Primarily you will be moving from structs to classes and then you will be manipulating your objects to perform some of the tasks from your earlier labs. You will write one or more class definitions that will hold the speaker information and the functions that will be associated with that data. You will create an array of objects of this class and you will manipulate the array to perform the requested tasks.  You may  NOT use C++ container classes for this lab

 

When the user runs your program, they must first enter data.  The data they entering will be the speaker information that you have researched to use as your test data.  The data entry tasks are

 

¥           Have the user call the program and pass in the name of the input file as a command line parameter if using file input.

¥           Introduce the speaker database to a new user.

¥           Define a class to hold the data for a speaker.  The members of this class should include:

            Private data members for all the campus speaker data that was in the struct in lab #3

            Appropriate accessor and mutator functions to use all the private data members

            At least one constructor and one destructor function

            A private member function that determines if an event is PAID or FREE and

                        Stores the results in the event price enum data member of the object

¥           Create an array of objects into which the user enters the speaker data.

            Get input values for all speakers  (this is the end of the data-entry phase of the program)

 

After getting all the input data for the speakers and performers from the user (and storing it in array of objects), you will allow the user to do the following for the menu-driven part of the program:

 

1)   Using the data in the array of objects,

      A)  Search for speakers/performers by

            i.    Speaker code

            ii.   Speaker name

      B)  Calculate

            i.    Length of time from current date to speech date

            ii.   Minimum and maximum ticket receipts for a speaker

      C)  Sort the data by

            i.    Speaker code

            ii.   Speech/performance date

2) Update the data in the array of objects Ðthis will take the user to a submenu for doing updates

3) Print all the data in the array

4) End the program

 

¥     Write the program in such a way to use multiple physical files with a minimum of:

            One file for the class definition

            One file for the class functions

            One file for the main routine

*    OPTIONAL: Write the program in such a way as to be able to conditionally compile it

            a) with debugging turned on or

            b) with debugging turned off

 

--------------------------------------------------------------------------------------------------------------------------

 

Data Description:  For lab #4, you will be storing the input data in an array of objects.  You will declare a UTAspeaker class to hold the private data members and public member functions.  The data will be input from a file. Each line of the file will contain the data below.

 

The private data in the UTAspeaker class should be:

 

1) Speaker code Ð a number of less than four digits that represents the specific speaker.  Each speaker in our system will have a unique code associated with them.  The code will indicate that the speaker is part of a particular series (see the series codes at the end of the lab assignment).  As an example, Ken Burns is the first speaker in the Maverick Speaker Series so you could code him as 100.  You will have to create codes for each possible speaker/performer who can be put in your database and you will have to inform the user what the valid codes are. 

 

2a and 2b) Speaker last name and speaker first name Ð two single words with no blanks and less than 40 characters long each that gives the speakerÕs first and last names.  In lab #2 we are using strings for the speaker name but we are making the string input simpler by insuring that each name string is one word, i.e. Mary_Jo Scott is one word for first name ÒMary_JoÓ because there is an underscore instead of a blank. 

 

3) Performance date given as day, month, and year Ð three separate numbers.

 

4) Time of event Ð given in military time.   [If you do not understand Òmilitary timeÓ is then look it up or ASK.]

 

5) Series code Ð a character representing the series or event that the speaker/performer is part of. The valid series/event codes are:

 

M Ð Maverick Speaker Series

E Ð Engineering Speaker Series

D Ð Engineering departmental sponsored event

C Ð College of Engineering event including Engineers Week

S Ð College of Science event

U Ð University sponsored event including EXCEL activities, Homecoming, etc.

L Ð Levitt Pavilion concert or event

O Ð Other

 

6) Ticket costs Ð a cost in dollars and cents.  Ticket cost has two values: early-bird purchase or regular purchase.  Tickets can be free.

 

7) SpeakerÕs home state Ð two letter code using US postal codes or the code NU if the speaker does not live in the US.

 

8) Speaker date of birth given as day, month, and year Ð three separate numbers.

 

9) Speaker expertise Ð a character representing the speakerÕs field of expertise.  The valid expertise codes are:

 

A - Aerospace Engineering

B - Bioengineering

C - Civil Engineering

P - Computer Science and Engineering

E - Electrical Engineering

I - Industrial Engineering

M - Mechanical Engineering

S - Materials Science and Engineering

O - Other Engineering

Z - Science

L - Liberal Arts

D - Education

X - Business

N - Nursing

R - Architecture

W - Social Work

U - Urban and Public Affairs

G - General

 

10) Event price Ð a variable of the Event paid-or-free enumerated type.  The value of this variable is determined by the program based on the ticket prices that are given.  [Event paid-or-free typeÐ This must be an enumerated type with two values.  One of the values should indicate if the event requires paid tickets, i.e. early-bird or regular tickets are greater than $0 cost,  and the other value would indicate that the event is free, i.e. both early-bird and regular tickets are $0 cost.]

 

11) Event seats Ð a variable of the Event ticket-or-seats union type.  The value of this variable will be read in but the correct meaning must be determined by the enumerated type value and then the value that is read in must be stored in the correct member of the union. [Event tickets-or-seats type Ð This union type should hold two possible pieces of data.  One piece of data would hold the current number of tickets that have been sold for events that have paid tickets.  The second piece of data would be the total number of seats in the event location and this would be the value used when tickets are free to the event.

]

 

12) Speech title Ð a string with blanks the gives the title of the speech.  The maximum length of the speech title is 128 characters.

 

 

The format for each piece of data is listed below. 

 

Speaker code is a single integer value of less than four digits.  Use the hundreds place digit to represent the series.  For the first speaker, the speaker code would be read in and error checked.  If the value is valid, i.e. it passes error checking, then it is stored in the current object, current.spkrcodeError checking should make sure that the value that is entered is one of the valid values for a speaker code based on the valid codes which your program offered to the user.

 

Speaker first name is a single word of less than 40 characters.  In the object the string can be declared as an array or as a char pointer.  The string will be read in with the %s specifier in a scanf statement into a temporary string.  The length of the string should be checked using the strlen command.  If the string is less that 40 chars in length then it should be copied to the current  object, current.first.  Before copying, make sure that there is space allocated if the object data member is a pointer instead of an array.

 

Speaker last name is a single word of less than 40 characters.  In the object the string can be declared as an array or as a char pointer.  The string will be read in with the %s specifier in a scanf statement into a temporary string.  The length of the string should be checked using the strlen command.  If the string is less that 40 chars in length then it should be copied to the current  object.  Before copying, make sure that there is space allocated if the object data member is a pointer instead of an array.

 

Performance day is an integer value.  It should be error checked and then a valid day value stored in the current  object.

Performance month is an integer value.  It should be error checked and then a valid month value stored in the current  object x.

Performance year is an integer value greater than 2000 and less than 2050.  It should be error checked and then a valid year value stored in the current object.

 

Performance time is a floating point value in the form HH.MM where HH is the hour value in military time and MM is the minute value.  You must error check both the hours and the minutes for validity.  If it is valid, it should be stored in the current  object y.

 

Series code is a character value.  It must match one of the valid series/event codes.  If it is valid, it should be stored in the current  object.

 

Early-bird Ticket cost is a floating point value.  It must represent valid dollars and cents.  An event can be free.  A valid ticket price should be stored in the current object.

Regular Ticket cost is a floating point value.  It must represent valid dollars and cents.  An event can be free.  A valid ticket price should be stored in the current object.

 

State is two character values stored in a two char array inside the object.  You must error check the two-letter state code to make sure it matches a valid US postal code (include Puerto Rico and Guam).  If it does not match any US, then it's value should be NU.  You may read in the two characters separately in the 2 char array or you may read it in as a string to a temp array and then use strncpy to put the two chars into the object.  The array elements are current.state[0] and state[1]

 

Birth day, month, and year are integers and should be handled the same way as performance date except that the birth date must be at least 10 years in the past.

 

Expertise code is a character value.  It must match one of the valid expertise codes.  If it is valid, it should be stored in the current  objectx.

 

Event price is an enumerated type value of the Event paid-or-free type.  Its must be automatically determined by the program any time a ticket price is read in or updated.  Ticket prices that are both zero $0 should assign an Event price value of FREE.  If either ticket price is non-zero, the enumerated type value should be PAID.

 

Event seats is a union type value of the Event seats-or-tickets type.  An integer will be read in for this value.  If the value of Event price is FREE then the integer value should be stored in the seats member of the union.  If the value of the Event price is PAID then the integer value should be stored in the tickets member of the union.

 

Speech title is a string of up to 128 characters.  In the object the string should be declared as a char pointer.  Space for the string should be malloced with a size of 30 chars.  The string will be read in with the getline function into current.title.  The length of the string should be checked using the strlen command.  If the string is greater than 128 chars in length then it should be truncated. 

 

 

Member functions:

 

Along with the data members, your class definition must include member functions in the public section to access and modify the private data members, and to display the values.

 

Each private data member must be accessible through at least two public member functions: one that allows the data to be changed (mutator) and one that returns the current value of the data (accessor). As an example, the Series code data member should have at least the following two public functions associated with it:

An accessor function, e.g. Get_Series_code( ) [or Series_code_is( )], that would return the current value of that data member, and

A mutator function, e.g. Set_ Series_code ( char typ), that would take in a char value, verify that the value was a legal value for this data member (for example checking that it was a meaningful choice), and if it is OK, then saving the value into the data member and returning some indication (possibly a bool) that indicates if the value was set.

 

It is OK to have member functions that get and return groups of values (like getting the Performance day, Performance month, and Performance year, all together as Get_ Performance_date() ) but do not include more than four data members for access or modification in the same function.

 

You must write a constructor function for your class that initializes the data members. You must write a destructor function for your class that cleans up any allocated space such as the name.

 

Another public member function must print all of the data of the class in a formatted way. This function is only printing the data for one object of the class type.

 

A private member function must be included to determine if an event is PAID or FREE and to store the results in the event price enum data member of the object It must be called by the mutator functions for Early-bird Ticket cost and Regular Ticket cost so that event price will change when either of them change.  Note that this means that a private data member must exist to hold this value as well as an accessor function to print the value with.

 

 

Lab #4 Initial tasks

            Have the user call the program and pass in the name of the input file as a command line parameter if using file input. :

When the user runs the Lab #4 program the user should call the program with a.out and should include the name of the file containing the input data that could be used with the program, for example, abc1234lab3data.txt.  Therefore to run this program the user must enter a.out abc1234lab3data.txtThe program MUST read from the file.

 

            Introduce the speaker database to a new user.

For this task your system must provide an introduction/welcome screen to the user. The screen should briefly describe what the system will do. You may have the welcome screen stay up for a fixed period of time or you may let the user press a key to continue on with the program. Make sure you tell the user what to do if you want them to press a key.

 

*          Declare a class to hold the data for a speaker, including all the functions needed to access or modify the data in the private section of the class. This class and the enumerated type and union type should all be declared globally.

 

The class for speakers should be defined globally [using the speaker.h and speaker.cpp files]. The actual speaker objects should be declared as an array of maximum size 40.

 

The lab must allow the user to enter any number of speakers into the speaker array up to 40 using file input.  For the file input, the program should stop reading new speakers when it reaches the end of the file.  For the lab, you must read lines of speaker data from a data file. The file input in C++ and the input data file are described below.

 

To use an input file with C++ takes the following steps:

      1) at the top use #include < fstream.h > or just fstream without .h

      2) declare an input file stream object, connect it to a physical file, and open the file by a declaration like the following:

            ifstream infile("lab4data.dat");

      where ifstream is the input file stream class type, infile is the object, i.e. variable, name, and "lab4data.dat" is the name of a file that you want to use for the input file. Notice that this declaration does the equivalent of both declaring a FILE * variable and doing an fopen command in C. Now you should be able to use the infile object anywhere that you would use the cin object. You may choose your own object variable name. You should use the same input file as for Lab #3.

 

Data-entry phase

 

Input Implementation: 

 

For Lab #4 the user must enter at least 12 speakers.  For Lab #4, you must implement file input.  No other data entry method is required.

 

File of lines input method

You must implement two options for getting the name of an input file.  First, your program must accept a command line parameter for the input file name if desired by the user.  Clearly indicate how to use the command line parameters in your e-mail when you turn in your lab assignment including the name of your test data file.  Second, your program must allow the user to type in a file name and then read from that file. 

 

When your user selects file input as the method of entering data, your program should first check to see if the user entered a file name on the command line.  If a valid file name was entered, then the program should ask the user if they wish to use the file name that was entered.  The user can choose to use the file name already given on the command line or they can enter the name of another data file to use.  Once the input file is determined and has been verified, your program will read the data from the file.

 

You must create at least two data files that contains more than 20 lines of event data and you must read the data from either file.  To do file input in C++ requires creating stream variables, opening the file and linking it to the stream variable, and then reading the data from the file using stream extraction and insertion operators in the same way that a line of data would be read from the screen.  If the file name was entered from the command line, the validity of the file name must be determined before trying to use the file for input.

 

The format of the data in the file is the same as Lab#3 and you should use the same input for from Lab #3 for Lab #4.  This data would be an integer for speaker code, ints for day, month, and year, chars for series code, the two char state code and the expertise code, floats ticket prices and time, words for first and last name, a number for tickets or seats, and a string for the title.  You must tell the user exactly how to enter the line of data.  The data for a single speaker/performer will be entered by the user as values on one line as follows {there must be one space only between the values}:

 

> 100 24 9 2010 19.00 M 0.00 0.00 NY L 29 7 1953 Ken Burns 525 An Evening with Ken Burns

 

which represents Ken Burns (code 100) on 24 September 2010 at 7:00pm (19.00 in military time) as part of the Maverick Speaker Series with free early-bird tickets and free regular tickets.  He is from New York, his birthday is given as July 29, 1953 and his area is Liberal Arts (since heÕs a filmmaker).  There are 525 seats in the venue.  The title of the event was "An Evening with Ken Burns"

 

The first line of the file will just be a line of data that would be read with fscanf and getline commands very similar to the Line of data input method commands.

 

Your program will read the first number and store it in the current object in the array, then read and store the day in the same object, then read and store the third number  in the object, and so on.  Your program should read all the numbers and chars within a single input command using concatenated stream extraction operators J .   Your program should read in as many lines of input for speakers as the user gives up to 40 or the end of the file whichever comes first.  You may read the string in the same stream extraction command or in a separate command getline.   For purposes of Lab #4 you can continue to use C strings and string functions. Just make sure you include the correct library files for those functions.

 

 

Input verification:

When all the speakers/performers in the file are entered, print out all the input speaker data in an easily readable form, ex. use a table with headings, or columns with headings or rows with labels.  It is strongly suggested that this printing be written as a separate function that can be called at any time in the program to print the current contents of the arrays.  It is also suggested that a small function be written which will print the name of a speaker given the speaker code as input.  The function could have a switch or a bunch of if statements in it.

 

Menu-Driven Phase

 

Task Description:

 

Once all the data is read into the object array your program should give the user a main menu with the following choices:  (use any number scheme you wish)

 

A)  Search for speakers/performers by speaker code

B)  Search for speakers by last name

C)  Calculate length of time from current date to the date of the speech/performance

D)  Calculate minimum and maximum ticket receipts for a speaker

E)  Sort the data by speaker code

F)   Sort the data by speech/performance date

G) Update the data in the array of objectsÐthis will take the user to a submenu for doing updates

H) Print all the data in the array

I)   End the program

 

The search functions for codes and date should let the user enter a speaker code and then look through the array to find the first speaker that matches that code/date.  Print a sentence stating that matching code/date was or was not found and if found, also print the code and the name of the speaker.  For the Lab #4 it is only necessary to return the first speaker that is found as a match. 

 

The search functions for last name should let the user enter a speaker name and then look through the list to find the first speaker that matches that last name.  Use binary search like Lab #2 for the name search.  Print a sentence stating that matching name was or was not found and if found, also print the code and the name of the speaker and all the data for the speaker.  For the Lab #4 it is only necessary to return the first speaker that is found as a match. 

 

The calculate time-until-speech function will determine the length of time by comparing current date and speech date.

 

The calculate min-and-max tickets function will first check to see if a number of tickets is recorded in the enum and union variables.  If so, then the number tickets times the early-bird price is the min receipts and the number of tickets times regular price is the max receipts and these values should be printed.  If no number of tickets is recorded, then print a message stating that there is not ticket amount to calculate.

 

Sort-by-speaker-code should use bubble sort to order the object array based on the speaker codes from smallest to largest.

 

Sort-by-date should use bubble sort to arrange the object array in order based on the date of the speech/performance from earliest to latest.  Make sure you work out the algorithm for comparing two dates before you try to write the comparison tests for the bubble sort.  YouÕll have to use the day, month, and year values to do this.

 

The update option should take the user to a second screen to allow them to update information in an object in the array.  This screen should ask for a speaker code or a last name from the user and search for that speaker/performer.  Once the correct speaker is determined save its pointer value and give the user a menu of the following options:

 

      o   Change speech/performance month, day, or year

      o   Change the series

      o   Change the two state chars

      o   Change one of the tickets

      o   Change the time

      o   Change birth month, day, or year

      o   Change the expertise code

      o   Change the first name

      o   Change the last name

      o   Change the number of tickets or seats (make sure to update the enumerated value if needed.)

      o   Change the title

      o   Return to main menu

 

For any change the user wishes to make, do the same error checking as in the original data entry section.  After each change is made, print all of the speaker info at [index].   [Hint:  If you write your data entry section with little functions for each input check then you can reuse them all here.]

 

Print all data in the array: Should do the same task as the input verification printing at the end of input.

 

When the user chooses "End the program" from the main menu, print a concluding message and then gracefully end the program.

 

 

Implementation Requirements:

 

WRITE A DESIGN DOCUMENT FIRST.  The design must include

 

a) all the classes you expect to write including data members and member function descriptions,

 

b) all the functions you expect to write that are not part of any class, and

 

c) some indication of which function calls what other functions.

 

Each function should accomplish one main purpose and each function at a lower level should have a more specific purpose than the function that calls it.  Each private data member in the class should have an accessor and a mutator function defined as public member functions in order to use and manipulate that data member.

 

The design document may be written as lines of text or as diagrams (such as a diagram that start with the main function at the top and all others below it) or as some combination of those, but it must include the information listed for a), b), and c) above.  Be sure to include all the functions that are described in this lab assignment.  This design documentation will be turned in for the lab and a design will be required to be turned in for Lab 1 and all later labs.  See the website for the DESIGN DOCUMENT due date.  It is usually ONE WEEK PRIOR to the lab due date.

 

*** A Lab #4 Design Document must be turned in on time in order for your Lab #4 assignment to be graded. ***

 

Write the program in such a way to use multiple physical files:

 

Your program must have one file for the class definition that should be name with the same name as the class followed by .h . For example, if your class is Elmo then your filename for the class definition should be elmo.h . Your program should use a second file for all of the function definitions for the member functions of your class. The name of this file should be the same as the class definition file with the suffix .cpp . (Ex. elmo.cpp) Your main routine and any functions that are not part of the class should be in another file that is named using the regular class naming structure of xxx1234blahblah with the suffix of .cpp instead of .c after the name. You may split your main routine and other non-class functions into separate files if desired but it is not required.

 

In your file containing main make sure you #include the iostream file and that you have the line

 

using namespace std;

 

after the #includes to make C++ work well, i.e. make C++ be able to find its library files.  Also remember to #include the speaker.cpp file in the file with the main routine. The speaker.cpp file should #include the speaker.h file.

 

 

The program should use the following data structures:

            A user defined class which contains private data member elements to hold all the required information for one speaker and public member functions to access that data.

            Array of objects instantiated from the class

            Files for data input

            Global CONSTANTS for specific and/or minimum values given in this assignment.  Constants can be done with #define or with the const declaration. 

 

The program should use the following control structures:

            Function calls to perform tasks

            A while or for loop to read the input data

            If, if-else, nested ifs, or switches to error check and implement the menu options

            Recursion for binary search

 

The program should NOT use:

            global variables

            exit

            break (except in a switch)

            continue

            container classes

            or any topic not covered in class before the lab DUE date unless approved in writing by the instructor

 

Programming practices:

Comment your code!  Use headers as described below, use line comments and use block comments.  Line and block comments should explain the meaning of the code.  As an example compare the following examples of code with comments:

 

Example 1:

/* Find A by multiplying L times W */

A = L * W;      // A is the product

 

Example 2:

/* Find the area of the rectangle by multiplying length times width of the sides */

A = L * W;  // A is area, L is length of one side, W is length of perpendicular side attached to L

 

While Example 1 has comments, the comments do not tell us anything extra about the code.  The code itself tell us that A is the product of L*W.  In Example 2, the comments are meaningful and explain the goal of the code and the meaning of the variables.  Make your comments like Example 2 not Example 1.

 

The program should have a program header which gives, at least, your name, the number of the lab assignment, your class and section, the assignment date, the due date, and a description of the program.  If multiple files are used, each file should contain a similar header.  See your instructor's website for SPECIFIC instructions about the program header.

 

Each programmer-defined class should have a class header similar to those used in the examples in the textbook. This header should include at least the purpose of the class, and its expected use.

 

Each programmer-defined function, i.e. each function you write, should have a function header similar to those used in the examples in the textbook.  This header should include at least the function name, the purpose of the function, and its inputs and outputs.

 

The program should be implemented as a class for the main data and a set of global functions with a main routine and at least one function for menu operations, two for getting input, one for printing, and all of the functions listed for the user choices.  You may use many more functions than this but you must use at least this many. The purpose of classes is to group together all the information that pertains to the same data concept and the purpose of the functions is to divide the problem into small tasks, each one assigned to its own function and then to call the functions from main() or from another function when appropriate. Do not code the entire program in main!

 

The program should perform the following actions in the given order:

            Declare and initialize the variables

            Print a welcome screen for the user that introduces the system

            Get the needed input values from the keyboard or file

            Print the appropriate outputs

            Let the user make additional choices until the user indicates that they are finished.

 

Output requirements:

The program must be run and the output recorded in a script file from OMEGA using the gcc compiler. No Exceptions! If you do not know how to create a script file, it is your responsibility to ask the TA, look for help on the class website, or OIT how to use this function.

 

You must come up with information to use as test data for at least 25 speakers/performers who will be at UT Arlington (or nearby) this year.  The speaker name, the series they are part of, the date and time they are speaking, and the ticket price must all be real data.  You should look at the speaker bios to determine the speaker's home state and birthday.  The information for the Maverick Speaker Series, the Engineering Distinguished Speaker Series, and other speakers and programs sponsored by EXCEL can be found on the University of Texas at Arlington website.  See the Miscellaneous section below for links.

 

Testing:

This program must be run with two different sets of test data for the input data.  You must create two different data sets and run your program with both of them.  I will give you a small amount of sample data at the end of this lab for you to use as a model.  You may run your program two times within a single execution or you may execute the program two different times so that you have a total of two different data sets. The sample data sets that you create must meet the guidelines given in the problem definition.  Your test runs should demonstrate all the choices that are available in your program.

 

NOTE ABOUT ERRORS:

 

Programs turned in for credit MUST compile and run WITHOUT any compilation errors or runtime errors using the g++ compiler on omega.  No other compiler may be used for the compilation for credit.  No other operating system may be used for the compilation and/or execution for credit.

 

Compilation errors occur while the program is being developed and they prevent the program from compiling correctly. Programs compile correctly when running

 

>g++ myprogram.cpp mydata.txt

 

gives no error messages.

 

Programs may be turned in for credit when they are partially complete but all completed functions must run without any errors. A program completes without runtime errors if it ends only when the user selects for the program to end and it correctly prints the exit message. Partially complete programs that run correctly for all implemented menu choices will receive partial credit.

 

Any other type of ending is a runtime error or a "crash". A program has a runtime error if it compiles and runs but then crashes in any situation, i.e. if there is any set of choices the user can make that will make the program crash. It is your responsibility to test all possible choices in your program to make sure that none of them cause a runtime error. The goal of creating input test data and running your program with it should be to test all of the various choices in your program to make sure all of them terminate correctly.

 

Labs which have errors in them and do not terminate normally will receive an overall grade of 0 (zero)

 

 

Lab #4 Grading Scale:

Code:  (63%)

            Program header, class and function headers for all classes and functions     (2 points)

            Comments (line comments and block comments)      (4 points)

            Modularity (division of the problem into small tasks, each one assigned to its own function and called from main() or from another

                        function when appropriate--do not code the entire program in main!)  (2 points)

            Style (indentation, consistency, meaningful identifiers, lateral separation of code from line comments, etc.)  (2 points)

            Quality and correctness of code (simplicity, readability, testability, etc.) (4 points)

            Correct syntactical definition of class giving class name, indicating the public section and the private section, and correct syntax for

                        member function prototypes (5 pts)

            Correct inclusion of data members in the private section of the class (5 pts)

            Correct definition of accessor functions for all data members (6 pts)

            Correct definition of mutator functions for all data members with proper input error checking (7 pts)

            Correct definition of constructor and destructor functions (3 pts)

            Correct definition of print (display) function (3 pts)

            Correct input to object members using data file (4 pts)

            Correct creation of the array of objects (3 points)

            Correct implementation of required algorithms binary search on array (4 points)

            Correct function structure as required (4 points)

            Proper implementation of data input and input error checking (5 points)

Output:              (27%)

            User clearly understands what is being requested for input (2 points)

            Search (find) tasks perform correctly using accessor functions to compare (5 points)

            Sort task performs correctly using accessor functions to compare (5 points)

            Free-or-paid function performs correctly using private member function and data (3 points)

            Input verification shows valid values and list of inputs correctly saved and printed including length of run (4 points)

            Output gives clear information to explain the values to the user (3 points)

            Output contains all required test data (5 points)

Object orientation:      (10%)

 

Grading Deductions:

            Use of global variables will result in an overall grade of 0 (zero) [-100 deduction]

            Use of container classes will result in an overall grade of 0 (zero) [-100 deduction]

            Use of the exit, break (outside a switch), or continue command will result in an overall grade of 0 (zero) [-100 deduction]

            Labs which have compilation errors or warnings will receive an overall grade of 0 (zero) [-100 deduction]

            Labs which have execution errors in them and do not terminate normally will receive an overall grade of 0 (zero) [-100 deduction]

            Missing design document or missing script file or missing C++ code or missing data file(s) will result in an overall

                        grade of 0 (zero) [-100 deduction]

            Late submission of softcopy of code and/or script file to appropriate TA will result in an overall grade of 0 (zero) for Lab#4

                        NO EXCEPTIONS [-100 deduction]

            Use of C++ language elements not yet discussed in class by the lab due date will result in potential deduction of points

                        - discuss with instructor before using.

 

Miscellaneous:

For Maverick Speaker Series (series code M), number each speaker in order from 100.  Therefore Ken Burns is speaker code 100, Rick Bayless is code 101, etc.       http://www.uta.edu/maverickspeakers/index.php

For Engineering Distinguished Speaker Series (series code E), number each speaker in order from 200.  Therefore Dr. Vincent Poor is speaker 200, Dr. Cristina Amon is 201, etc.

            http://www.uta.edu/engineering/speakerseries/

Other engineering events with codes D or C should be numbered with codes starting with 300. For example, see http://www.cse.uta.edu/news/seminars/InvitedTalks.asp?pageVer=

University Events (series code U) include concerts.  The page at http://www.uta.edu/studentaffairs/universityevents/ue/ will have a listing for a Fall Concert and that performer should be included when available.           University Event speakers or performers should be numbered starting with 400.

College of Science (series code S) speakers would include astronaut Barbara Morgan.  This info can be found at https://www.sallyridescience.com/festivals/10uta1030.  Number any College of Science speakers starting at 500.

Concerts at Levitt Pavilion (series code L) can be included for speakers/performers.  Number these performers starting with 600. http://www.levittpavilionarlington.org/

Number any speakers from series code 0 starting with 700.

 

Format of the data:  First line is the data used as an example above.  Do not include the comments in your data file (if using a file). 

 

100 24 9 2010 19.00 M 0.00 0.00 NY L 29 7 1953 Ken Burns 525 An Evening with Ken Burns

603 4 9 2010 19.30 L 0.00 0.00 TX L 13 11 1946 Ray_Wylie Hubbard 2300 Levitt Pavilion performance           // Ray Wylie Hubbard at Levitt Pavilion

501 30 10 2010 13.00 S 20.00 200.00 ID D 28 11 1951 Barbara Morgan 300 Engineering for space   //Barbara Morgan at Sally Ride Science Festival

201 5 10 2010 18.00 E 0.00 0.00 NU B 4 1 1960 Dr_Cristina Amon 525 Hierarchical Thermal Transport Modeling and Simulation in Semiconductors from Nano to Macro Scales

/* Dr. Cristina Amon (code 201) on 5 October 2010 as part of the Engineering Distinguished Speaker Series with free early-bird tickets and free regular tickets.  She is from Toronto, Ontario, Canada and speaks at 6pm. */