Lab #2 Assignment

CSE 1320-001

Summer 2011

Due Date: See class website for due date

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

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

 

Objective: The goal for this lab is to provide an opportunity for practice of C program development and the C programming topics covered in Chapters 1-6 and parts of later chapters in Foster and Foster as covered in class. It is assumed that the student is familiar with and can use all the concepts in those chapters. This assignment is designed to practice those concepts by creating a C program. This lab will introduce students to Dr. T's approach to lab assignments and to reinforce and refresh previously learned material about C and programming.

 

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. The format of this assignment is similar to the assignments that will be required for the rest of the semester so a student who is unsure of their skills can use this assignment to refresh them and to ask the instructor or TA about any concepts they are unsure of.

 

Topics:

Algorithms

One-dimensional Array

Multi-dimensional Arrays

Strings

Control structures

Functions

Arithmetic and relational operators

Input and output,

Passing parameters

Data types

Global constants

Pre-processor directives

Searching

Program design

Modular programming structure

Error checking

Programming style

Compiling code,

Executing code,

Debugging and testing.

 

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: This semester our theme will be working on a support system to manage information for a theater company. You are going to put together a small database of information to help make show reservations and to handle other aspects of the theater production. 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.

 

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), continue, structs, passing by reference (except arrays), or linked lists.

 

Assumptions for the lab #2:

 

1) A maximum of 10 shows per week are allowed. Use constants to define the max value.

2) Strings will be single words with no blanks and the maximum length will be given.

3) The maximum number of shows for Lab #2 is 6. Use constants to define the max value.

 

 

Problem: The data in your database will be information about plays, musicals, dramas, comedies, and other live shows in local theaters, information about the shows and tickets for them, and other data needed regarding the shows. As part of this assignment you will have to find real data about local theater shows to use as test data for your program.

 

Your program will really be two related parts. First in the data-entry phase the user is entering all the data needed to find and manipulate the show data. You can imagine that this user is someone who works for the theaters and is entering all this data. This will be the first task that happens when someone starts running your program.

The data they entering will be the theater information that you have researched to use as your test data. Getting all the input data for the shows from the user and storing it in arrays, will all happen in the data-entry phase of the program. After getting all the input data for the shows from the user, your program will then go into menu-driven phase. This will allow the user to do the following tasks. These tasks are actions that a theater patron might want to perform:

 

1) Using the data in the arrays,

A) Search for a show by

i. Type of show

ii. Theater location

iii. Date of show

B) Calculate

i. Cost for purchase of tickets for the show

ii. Number of times the show will be performed

C) List all the shows that meet certain criteria

i. Less than given cost

ii. Before or after a given date

iii. In the same city

D) Sort the data by

i. Show code

ii. Show date

2) Update the data in the arrays-this will take the user to a submenu for doing updates

3) End the program

 

 

Data Description: For lab #2, you will be storing the input data in some single arrays and some multi-dimensional arrays.

 

The data elements and descriptions are given below. Following this first list, the data elements are described by type.

 

1) Show code - a four (4) digit integer where the 1000s place represents a city, the 100s digit represents a theater company and the other two digits indicate a specific show. The guidelines for the city codes and theater company codes are given at the end of the assignment.

 

2) Show name - a single word with no blanks and less than 40 characters long that gives the show name. In lab #2 we are using strings for the name but we are making the string input simpler by insuring that all strings are one word, i.e. Jeeves_in_the_Morning is one word because there are underscores instead of a blanks.

 

3) Genre letter code - a letter representing the kind of show. Choices are:

D Drama

C Comedy

S Suspense

F Fantasy

M Musical

V Variety

R Revue

I One man show

O Any other type of show - such as a special performance

4) Show start date as day, month, and year - three separate numbers

 

5) Show end date as day, month, and year - three separate numbers

 

6) Number of shows per week

 

6a) Day of show as a letter (for each show in a week)

S Sunday

M Monday

T Tuesday

W Wednesday

R Thursday

F Friday

A Saturday

 

6b) Start time of show (in hours and minutes) - save as a floating point value HH:MM

 

6c) Show designation as a letter

R Regular

M Matinee

L Late showing

 

6d) Cost per regular adult ticket in dollars and cents - save as a floating point value

 

7) Total number of available seats for the show

 

8) Length of show from start to end in minutes

 

9) Number of adults attending (age 18 or older)

 

10) Number of children ages 2 through 17

 

11) Number of infants less than age 2

 

12) Show run - number of performances calculated from previous data

 

13) Tickets sold – calculated from previous data

 

The format for each piece of data is listed below.

 

You will use single dimension char array for the Genre letter code and a three-dimensional array for the Day of show and Show designation. You will use a two dimensional array for the Show name strings, and a three dimensional array of float data about a single weekly show. All the other data will be in the two-dimensional integer array. [OK, this isn't as confusing as it seems. J]

 

As an example, let's say the user is going to enter data for two shows. The first show will be to see “Alice Wonder” (code 1310) and the second show will be “The Hobbit” (2108). For each show you will be asking the user for all the pieces of data listed above and storing this data into the arrays. The different shows, in this case the first show and second show, will be stored on different rows. Each column then in the float and integer array will indicate a different piece of data about the show. In the string array, the name of each show will be on the same row as in the other arrays. In the two character arrays, the same row always refers to the same show. For the float and integer arrays, the number of columns is determined by how many pieces of data have to be stored. The number of rows is the same as the maximum number of shows that can be stored. (6 for this lab)

 

The integer array will have 6 rows and 15 columns because there are 15 pieces of integer info to be stored for each show. It is recommended that you create a set of constants to use for your column indices in the integer and float arrays, e.g. SHOW = 0, SHSDAY = 1, SHSMO = 2, SHSYR = 3, SHEDAY = 4, SHPERWK, etc. for integers and for floats SHTIME = 0, COST = 1, and then use them as the indices for your arrays, ex. showint[4][SHSMO] would be the location of the show start day of the 5th show in the integer array and showint[k][SHOW] would be the k+1th show code in the array.

 

The weeklyshowchar character array for Day of show and Show designation will have 6 layers (shows) and 10 rows (shows per week) and 2 pieces of data columns (one for Day of show (0) and one for Show designation (1)). HINT: Define a constant for Day of show like DAYSH. Remember with C arrays you start counting at 0, so 6 shows means 0 – 5, 10 per week means 0 – 9, and 2 pieces of data means 0 and 1. Therefore the show designation info of the 4th show on the schedule in its 7th showing per week will be at weeklyshowchar[3][6][DAYSH].

 

The three dimensional array will have 6 layers (shows) with 10 rows (shows per week) and two columns (start time and cost). Remember with C arrays you start counting at 0, so 6 shows means 0 - 5 and 10 legs means 0 - 9. Ergo, weeklyshowfloat[2][4][COST] would be the cost of the 5th weekly showing of the 3rd show on the schedule.

 

The multi-dimensional array for strings will store one string per row. The string array will have 6 rows and 40 columns, showname[6][40]. You will be using entire rows of the array rather than single characters, i.e. showname[k] will be the string that contains the name of the kth show. Make sure to declare all your constants before you try to use.

 

As you read in the shows, you will be numbering them from 0 up to 5. This is the shownum value used below.

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

Show code - a four (4) digit integer where the 1000s place represents a city, the 100s digit represents a theater company and the other two digits indicate a specific show. The guidelines for the city codes and theater company codes are given at the end of the assignment. You will have to validate the 100s place and 1000s place of any code entered by the user. For the first show, the show 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 integer multi-dimensional array at the SHOW index on the correct row for this show, showint[shownum][SHOW]

 

Show name - a single word with no blanks and less than 40 characters long that gives the show name. 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 showname[shownum] in the multi-dimensional array.

 

Genre letter code - a single character representing the kind of show. It must match one of the valid codes. If it is valid, it should be stored in the array genrecode[shownum].

 

Show start day is an integer value. It should be error checked and then a valid day value stored at showint[shownum][SHSDAY].

Show start month is an integer value. It should be error checked and then a valid month value stored in the showint array in the month[SHSMO] column at shownum.

Show start 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 showint array in the year column at shownum.

 

Show end day is an integer value. It should be error checked and then a valid day value stored at showint[shownum][SHEDAY].

Show end month is an integer value. It should be error checked and then a valid month value stored in the showint array in the month[SHEMO] column at shownum.

Show end 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 showint array in the year column at shownum.

 

Number of shows per week is an integer value. It should be error checked and then a valid value stored at showint[shownum][NUMSHOWS]

 

For each show in a week, the following for data items must be requested and stored:

Day of show is one letter per weekly show. It should be error checked and then a valid type code stored at

weeklyshowchar[shownum][weekshow][DAYSH] where weekshow indicates which show during the week this is.

 

Show designation is one letter per weekly show. It should be error checked and then a valid type code stored at

weeklyshowchar[shownum][weekshow][DESIGSH] where weekshow indicates which show during the week this is.

 

Start time for a show is a floating point value in the form HH.MM where HH is the hours in military time and MM is the minute value. It should be error checked and then a valid start time stored at

weeklyshowfloat[shownum][weekshow][START]

 

Cost per ticket is a floating point value. It must represent valid dollars and cents. The cost of a ticket can be free. A valid ticket price should be stored in the float array at weeklyshowfloat[shownum][weekshow][COST]

 

Available seats is an integer value. It will be entered by the user and error checked for a reasonable value. This should be stored in showint[shownum][SEATS]

 

Show length is an integer value. It will be entered by the user as a number of minutes. It must be greater than 15 and less than 1440. This is the length of the entire show and should be stored in showint[shownum][SHOWLEN]

 

Adult is an integer value. It should be error checked and then a valid number of adults stored at showint[shownum][ADULT].

Child is an integer value. It should be error checked and then a valid number stored at showint[shownum][CHILD].

Infant is an integer value. It should be error checked and then a valid number stored at showint[shownum][INFANT].

 

Show run is an integer value. It should be calculated from the number of days from the beginning to the end of the show, divided to get the number of weeks and then multiplied by the number of shows per week. If the number of weeks is a fraction, round up to the next whole number of weeks before multiplying. This value should be calculated automatically by your program after the data for a show is entered and stored at showint[shownum][RUN]

 

Tickets sold is an integer value. It should be calculated from the number of adult, child and infant tickets selected and kept as a running total as more tickets are purchased. It should be updated whenever the user chooses to calculate and purchase tickets. It should also be checked against the available seats number to guarantee tickets are still available. This value should be calculated automatically by your program after the data for a show is entered and as the user acts on the data and then stored at showint[shownum][SOLD]

 

 

Input Implementation: For Lab #2 the user must enter at least 3 shows and no more than 6. Since the user has a choice, then the first piece of data that the program needs from the user is a count of how many shows they are entering. The program should check to make sure this count is between 3 and 6. [Note for development: start with a smaller number of shows then increase to 3 when program is working well.] If the user's number exceeds 6, the program should inform the user that 6 is the maximum number of inputs allowed and have them reenter the count. Then your program must loop for count number of times (shownum= 0, 1, …count-1) to read and store input.

 

 

For Lab #2, you must implement the following two methods of input. The first method will prompt the user for each piece of data individually and the second method will allow the user to input all needed pieces of data about one show on one line. The two forms of the input are described below. After getting the count of shows from the user, the program must ask the user how they want to input the data. Your program must give them both choices of methods: Individual data method or line of data input method. Once the user has chosen the method of input, all the input will be done that way for the current run of the program.

 

 

Individual data method:

a. Ask the user for the show code (don't forget explain codes for them.) Read in their number, make sure it is a valid code and then store it in the integer array at the correct row [shownum] at column. As an example of an explanation, you might tell the user "Please enter a show code. Codes should be four digits with the first digit representing the city, the second digit indicating the theater company and the last two digits just being a unique code…" and then you can list the cities and theater companies for them to use. See the Miscellaneous section at the bottom for the show code info.

b. Ask the user for the genre letter code and give them the choices. Check to make sure it is a valid type. Store this valid character in the char array genrecode[shownum].

c. Ask the user for the month, day, and year for the start of the theater show. Make sure it is a valid date, i.e. it is a real date, and then store it in the integer array at showint[shownum][SHSMO], showint[shownum][SHSDAY],and showint[shownum][SHSYR].

d. Ask the user for the month, day, and year for the end of the theater show. Make sure it is a valid date, i.e. it is a real date and after the start date, and then store it in the integer array at showint[shownum][SHEMO], showint[shownum][SHEDAY],and showint[shownum][SHEYR].

e. Ask the user how many showings there are per week of this theater show. Store the number of showings in the integer array at the correct location, showint[shownum][NUMSHOW]

f. For each weekly show,

1. Ask the user for the day of show letter and give them the choices. Check that they entered a valid code letter and then store it at weeklyshowchar[shownum][weekshow][DAYSH] where weekshow indicates which show during the week this is.

2. Ask the user for the show designation and give them the choices. Check it and store it at weeklyshowchar[shownum][weekshow][DESIGSH].

3. Ask the user for the start time of the show entered as a floating point value representing HH.MM . Check that the value is positive, that HH is less than 24, and that MM is less than 60. Store the time in the floating point array at weeklyshowfloat[shownum][weekshow][START].

4. Ask the user for the cost of that theater show for a regular adult ticket entered as a floating point value representing US dollars and cents (ex. 450.99). Check that the cost is valid and store in the floating point array at weeklyshowfloat[shownum][weekshow][COST].

g. Ask the user for the number of seats that are available in that theater for that show. Check and store as appropriate.

h. Ask the user for the length of the show in minutes. Check and store as appropriate.

i. Ask the user for the number of adults, ages 18 and older, who will be attending this show. Check for validity and save this value in the integer array showint[shownum][ADULT].

j. Ask the user for the number of children, ages 2 through 17, who will be attending this show. Check for validity and save this value in the integer array showint[shownum][CHILD].

k. Ask the user for the number of infants, under age 2, who will be attending this show. Check for validity and save this value in the integer array showint[shownum][INFANT].

l. Ask the user for the single word name of the show. Make sure to indicate that blanks are not allowed. Read it into a temporary string and check the length. If it is OK, store it into the name string array at row [shownum].

 

 

Line of data input method:

Your program may ask the user to enter all the information for one show on the same line. This data would be an integer for show code, ints for day, month, and year of start and end along with counts of weekly shows, seats, minutes, and attendees, chars for genre code, day and designation, floats for ticket cost and start time, and a string for the name. You must tell the user exactly how to enter the line of data.

The data for a single show will be entered by the user as values on one line as follows {there must be one space only between the values}. Here's an example:

 

> 1310 C 5 27 2011 6 26 2011 5 R R 8.00 20.00 F R 8.00 25.00 A M 3.00 15.00 A R 8.00 25.00 S M 3.00 15.00 150 165 2 0 0 Alice_Wonder

 

which represents the show “Alice Wonder” (code 1310, name Alice Wonder) from May 27. 2011 to June 26, 2011 with five shows per week. The weekly shows are Thursday regular show at 8pm for $20, Friday regular show at 8pm for $25, Saturday matinee at 3pm for $15, Saturday regular show at 8pm for $25, and a Sunday matinee at 3pm for $15. There are 150 seats available and the show is 165 minutes long. Two adults are attending with no children or infants.

 

And a second example: [NOTE: this example is shorter because the show has less weekly performances]

 

> 2108 F 7 1 2011 7 10 2011 4 F R 7.30 10.00 A M 2.00 8.00 A R 7.30 10.00 S M 2.00 8.00 200 120 1 2 0 The_Hobbit

 

which represents the show The Hobbit (code 2108, name The_Hobbit) from July 1. 2011 to July 10, 2011 with 4 shows a week. The weekly shows are Friday regular show at 7:30pm for $10, Saturday matinee at 2pm for $8, Saturday regular show at 7:30pm for $10, and a Sunday matinee at 2pm for $8. There are 200 seats available and the show is 120 minutes long. One adult is attending with two children and no infants.

 

Your program will read the first number and store it in the integer array at the correct location, then read and store the character into the corresponding location in its array, then read and store the third number (month) into the int array, and so on. Your program should read all the numbers, chars, and the string within a single input command. Your program should read in as many lines of input for shows as were originally specified by the count up to the maximum of six lines of input (shows).

 

 

Input verification:

When the user has entered count number of shows, print out all the input show 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 show given the show code as input. The function could have a switch or a bunch of if statements in it.

 

 

Task Description:

 

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

A) Search for show by show designation

B) Search for show by date of show

C) Search for show by city

 

D) Calculate cost for purchase of tickets for theater show

E) Calculate maximum revenue for a show

 

F) Find all the shows in the same city

G) Find all the shows that are shorter than a given length of show in minutes

H) Find all the shows that cost less than a given amount

 

I) Sort the data by show code and print the sorted shows

J) Sort the data by show start date and print the sorted shows

 

K) Update the data in the arrays-this will take the user to a submenu for doing updates

L) End the program

 

The search functions should let the user enter a show designation or date or city and then look through the list to find the first show 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 show. For the Lab #2 it is only necessary to return the first show that is found as a match. Note that the city search will have to look at the show code city digit for this search.

 

The calculate-cost function will ask the user for a particular show code from those in the database (print the table of shows) and will then calculate and print the total cost of the tickets for all the attendees requested by the user. The cost of any show is calculated as follows:

The show cost for one adult is the ticket cost for that show.

The show cost for one child is equal to the three quarters of the adult show cost.

The cost for one infant is half of the child cost.

The total cost of a show for all attendees is the number of adults times the adult cost plus number of children times the child show cost plus number of infants times the infant cost.

 

The calculate-maximum revenue will be an approximation calculated as the regular adult show cost (for Friday night if this is different on different nights) times the number of available seats times the total number of shows. For purposes of this calculation in Lab #2, you can treat all shows as regular shows instead of matinees.

 

The find-all-in-city function should ask the user to choose the desired city from a list then go through every show and print the complete information for all shows that are in that city. You will have to use the show code to determine this.

 

The find-all-shorter-shows function should ask the user for a number of minutes and then go through every show and print the complete information for all shows that have a total length of show time shorter than the given theater time.

 

The find-all-less-than-cost function should ask the user to enter a show cost for one adult then go through every show and print the complete information for all shows that have that have a single adult cost equal to or less than that cost.

 

Sort-by-show-code should use bubble sort to order the arrays based on the show codes from smallest to largest.

 

Sort-by-date should use bubble sort to arrange the arrays in order based on the date of the start of the show 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 the arrays. This screen should print the shows in the database for them to choose from, ask for a show code from the user, and search for that show. Once the correct show is determined save its [index] and give the user a menu of the following options: [NOTE: for Lab #2, you will not have to make changes to the data for the weekly showings of the show. You will do so in later labs.]

 

o Change show start or end month, day, or year at [index]

o Change the number of attendees at [index]

o Change the genre letter code at [index]

o Change the name at [index]

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 show 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.]

 

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 functions you expect to write,

 

b) brief (one line) descriptions of each function, and

 

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

 

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. 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. 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 #2 Design Document must be turned in in order for your Lab #2 assignment to be graded.

 

 

The program should use the following data structures:

Multi-dimensional integer, floating point and string arrays, single-dimensional character arrays

Global CONSTANTS for specific and/or maximum values given in this assignment. Constants can be done with

#define or with the const declaration. Examples:

 

#define EVENTMAX 10

const int EVENTMAX = 10;

 

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

 

The program should NOT use:

structs

global variables

exit

break (except in a switch)

continue

pointers

any topic not covered in class before the lab DUE date unless approved 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 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 set of 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 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 ask OIT how to use this function.

 

You must come up with information to use as test data for at least 6 shows and shows. You may only have one show that is a single weekly showing - all other shows must have multiple weekly showings. Please use real data for shows and costs. Feel free to use theater websites to "plan" the show data for this lab. (There is a great starting point at http://www.dfwonstage.com/ ) See the Miscellaneous section below for other useful info.

 

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 gcc 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 and warnings occur while the program is being developed and they prevent the program from compiling correctly. Programs compile correctly when running

 

>gcc myprogram.c

 

gives no error or warning 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 compile and 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)

 

 

Grading Scale:

Code: (59%)

Program header and function headers for all functions (6 points)

Comments (line comments and block comments) (6 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!) (6 points)

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

Correct manipulation of the 1-dimensional char arrays (3 points)

Correct manipulation of the 2-dimensional integer array (3 points)

Correct manipulation of the 3-dimensional float array (3 points)

Correct manipulation of the 3-dimensional char array (2 points)

Correct manipulation of the 2-dimensional char array of strings (2 points)

Correct use of required control structures (6 points)

Correct function structure as required (6 points)

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

Output: (41%)

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

Search tasks perform correctly (3 points)

Find-all tasks perform correctly (4 points)

Calculate tasks perform correctly (3 points)

Sort tasks perform correctly using correct sort algorithm (6 points)

Update tasks perform correctly (3 points)

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

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

Output contains all the given test data and one additional data set (5 points)

Grading Deductions:

Use of global variables 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]

Use of structs or linked lists will result in 50 (fifty) point deduction per use [-50 deduction]

 

Labs which cannot be compiled or do compile with warnings will receive an overall grade of 0 (zero) [-100 deduction]

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

 

Missing design document 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) UNLESS

student has obtained prior instructor approval [-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:

 

Show code structure: The code will be a 4-digit number. The leftmost digit (1,000s place) will indicate the city as follows:

1 Fort Worth

2 Arlington

3 Dallas

4 Irving

5 Plano

6 Garland

7 Grand Prairie

8 Carrollton

9 Other DFW city

 

 

Following the city value will be a value in the 100s place that indicates one of the theater companies below. The codes for that digit will be:

1 Theater Arlington

2 Casa Mañana

3 Jubilee Theater

4 Stage West

5 Dallas Theater Center

6 Garland Civic Theater

7 Hip Pocket Theater

8 Kitchen Dog Theater

9 ICT MainStage

0 Any other theater company in DFW area

 

Therefore, a show code for “Alice Wonder” might be 1310 for Fort Worth, Jubilee Theater, show #10. Likewise “The Hobbit” might be 2108 for Arlington, Theater Arlington, show #8.

 

Sample data:

1310 C 5 27 2011 6 26 2011 5 R R 8.00 20.00 F R 8.00 25.00 A M 3.00 15.00 A R 8.00 25.00 S M 3.00 15.00 150 165 2 0 0 Alice_Wonder

2108 F 7 1 2011 7 10 2011 4 F R 7.30 10.00 A M 2.00 8.00 A R 7.30 10.00 S M 2.00 8.00 200 120 1 2 0 The_Hobbit