Problem Statement:

In this assignment, we will look at a way to develop a students' registration system using C for some college. The goal of this program is to allow the administrators to register a student in offered courses, and also allows them to drop a course for a student.

This assignment is intended to get you to practice using arrays, pointers, functions, header files, user inputs, and formatting output among other things.

Background Information

In this assignment we will have two arrays, one to store the student IDs, and the second is to store the course codes.

The student array must have at least 5 students, and the course code array must have at least 3 courses.

In addition, there will be a registration table, represented by two-dimensional array that will store the courses each student is registered in. This will be presented as a simple yes/no value stored in the registration table for each student using their index in the students array, and the course index in the courses array.

For example, if the system has three students with IDs {12345, 34567, 56789}, and have two courses with codes {"CST8234", CST8288}. Then the administrator can register a student with ID 34567 in a course with code CST8234 by recording Yes in the registration table for index 1 (representing the student index) and 0 (representing the course index).

The following illustrates the memory representation for of each of the arrays:

Address Students Index Value
0x303300 0 12345
0x303304 1 34567
0x303308 2 56789

Address Courses Index Value
0x308800 0 CST8234
0x308809 1 CST8288

Registration Table
Index Student Index Course Index Value 0 = no / 1 = yes
0 0 0 0
1 0 1 1
2 1 0 1
3 1 1 1
4 2 0 1
5 2 1 0

Consequently, from the above table we can see that the student with index 0 (ID: 12345) is registered in course with index 1 (Code: CST8288) only.

Requirements:

Write a program that achieves the following requirements:

1) The program should prompt the user to enter:

  • The number of students they wish to register.
  • The student ID for each student. Student IDs are 5-digit integers, i.e. 45234.

2) Students should be stored in their own array.

3) The program then should prompt the user to enter:

  • The number of courses offered.
  • The course code of each of these courses. Course codes are 7-digit alphanumeric strings, i.e. CST8234.

4) Courses should be stored in their own array.

5) The program then should prompt the user to choose one of three actions:

  • Register a student into a course.
  • Drop a student from a course
  • Display Registration table.

6) If the user chooses to register a student or drop a student, then the program should prompt for the student ID first then the course code second and perform the correct ac- tion as follows:

  • Validate the student ID as entered by the user. Display an appropriate error message if the student ID is not found and re-prompt the user for a valid student ID.
  • Validate the course code as entered by the user. Display an appropriate error message if the course code is not found and re-prompt the user for a valid course code.
  • Registering a valid student will update the registration table by adding "1" (i.e. true) to the element with the [student index][course index] element.
  • Dropping an existing course will update the registration table by adding "0" (i.e. false) to the element with the [student index][course index] element.

7) If the user chooses to display the registration table, the program should print all entries in the table.

8) Additional requirements:

  • Add another action to the menu that will allow the user to quit the program by choosing the quit action.
  • The program would loop until the user quits the program. The program will loop only starting from point 5 above, so the user doesn't need to enter the students or the courses information anymore.
  • Validate the menu action as entered by the user. Display an appropriate error message if the menu action is not found and re-prompt for a valid menu action.

9) Make sure you use functions, design your program to separate functionality into its own functions. Using only main function will make you lose points.

  • The .c files should contain functions that represent sensible groupings of functionality
  • You must define .h files as appropriate

10) Give your functions and variables a descriptive name. For example, students[], not x[].

11) Write a program that will implement ALL the requirements, explicit and implicit, listed above.

12) Each function must have a header comments that explain what it does, and describe/explain its inputs (if any) and return value (if any)

13) You must use a "makefile", with the CC_FLAGS set to -g -ansi pedantic Wall w), and OUT_EXE set to labAssessment#

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.