Project P7

A small project

This is a small programming project. It will be due on Thursday, October 13, because Tuesday, October 11 is during Fall Break. This assignment will count 50 points, twice the value of a programming exericise.

Programming projects are expected to have useful comments. Be sure to include some.

Due dates

This assignment must be submitted as a single file to the Moodle submission page for Project P7 by 11:00 PM on Thursday, 13 October.

Preparation for the assignment

After you have created your project, add a C source file called courses.c that contains nothing more than the single C array declaration and initialization shown below.

char courses[12][6] = { "ART230", "ART231", "ART330",
                        "ART430", "DAN138", "ECE200",
                        "ECE209", "ECE310", "EGM482",
                        "MAE206", "MAE301", "mae301" } ;

Do not use a #INCLUDE for courses.c. Just put courses.c in your project, just like you put ellipse.c in Homework E6.

You should not assume that your program only needs to work with a courses array exactly like the one above. You should also not assume that all letters in the courses array will be upper case or that the first three characters will be letters or that the last three characters will be digits.

Within your main C file, place the following statement before the main routine.
extern char courses[12][6] ;
The linker will make sure courses can be used in your program as an externally defined variable.

The assignment

In this assignment your program will read a six-character line, representing a course, from the user and compare it to the twelve different courses stored in courses.

For each of the twelve courses, your program should do the following. First, it prints the name of the course taken from courses. Second, it compares, character ty character, the input course with the one from courses. If the letters are the same when both are translated to lower-case using C’s tolower routine, the character | is printed. Otherwise, $ is printed. Third, it prints the input course.

For example, suppose Egg444 is the input course. When Egg444 is compared to EGM482, the following lines should be printed.


To verify that your program is correct, you can compare your output with my output when the input course is eve002 and courses is initialized as above.

Some advice

Do not try to write this program in one setting. Try something like the following.

On Wednesday, write a program that prints each course from courses once.

On Thursday, write a program that reads an input course and then prints each course from courses followed by the input course.

On Friday, show up at the problem session, which will talk about comparing two six-character arrays.

Enjoy your break from Saturday until Tuesday, but spend a couple of hours finishing up your solution.