For this assignment, you will be writing a program that performs a complex data base operation using hash tables, arrays and set. Some example code is provided to help you to understand the data available and how to use it.
You will be submitting:
1) A file called a6.c that contains a program (including a main function that performs as described below). Do not include any of the functions from the instructor supplied file “hash.c” in your code. #include the file hash.h in your code.
2) A makefile that complies a6.c into a file a6.o and links the file a6.o with the file hash.o (based on hash.c provided by the instructor), to produce an executable called a6.
3) If you submit any *.rel, *.idx, *.hash, or *.txt files to your git repository you will be deducted 2 marks per file. (Do not add a *.txt entry to your git ignore file or you will not be able the receive feedback on your A6.)
You will submit all of your work via git to the School’s gitlab server This is an individual assignment. Any evidence of code sharing will be investigated and, if appropriate adjudicated using the University’s Academic Integrity rules.
Your program will accept 2 command line parameters. The first will be a building designation that matches one of the building designations in the file building.txt. The second will be a room number that matches one of the room numbers in the file room.txt. Your program should search the database and find all classes that occur in that room. And use the following print statement to print out the details for each class:
printf( “%s*%s %s %s - %s\n”, subject, courseno, days, from, to );
Your program should not print anything else. If there are no classes in the room, the program should quit without printing anything. For the first 80% of the assignment, the print statements are allowed to contain duplicates and need not be in any particular order.
In addition to a file hash.c and a file hash.h a number of example programs are provided by the instructor, along with a makefile. The following are some examples of how to use the example program to accomplish the same task that you are required to do (albeit in a very manual and painstaking way).
*./get_idx building ALEX This will print the index associated with the building Alexander Hall.
*./get_idx room 200 This will print the index associated with room number 200.
*./query code -1 building 3 building_3.set This will search for all codes that are associated with building index 3 in the code_building.rel relation file. It will store the resulting set of codes in the file building_3.set which is a file consisting of 1 char for each code, set to 0 if the code is NOT associated with the building and set to 1 if the code IS associated with the building.
*./query code -1 room 49 room_49.set This will search for all codes that are associated with room index 49 in the code_room.rel relation file. It will store the resulting set of codes in the file room_49.set which is a file consisting of 1 char for each code, set to 0 if the code is NOT associated with the room and set to 1 if the code IS associated with the room.
*./and building_3.set room_49.set alex200.set This will computer the set intersection of the building 3 and room 49 sets and store the result in the set alex200.set.