CS112 Data Structures and Algorithms

The University of the South Pacific 
School of Computing, Information & Mathematical Sciences 
CS112 Data Structures and Algorithms 
Semester 2

Assignment 1 - Object-Oriented Programming

You are required to build the course approval system for USP. Currently, during the registration week academics manually check if a student is meeting prerequisites for a given course. Write a object oriented program in C++ to solve this problem. For simplicity assume there is no more than one prerequisite for any given course. Three sample files are given for you in Fig.1 to verify your program. Courses.txt shows courses with corresponding prerequisites (0 means a course is offered in both semesters 1 means that course is offered in semester 1 and 2 means that a course is offered in semester 2), CSstudents.txt shows list of courses passed by the students, Students.txt shows list of students at USP and Registration.txt shows list of students with current registration. Do not change the format (columns and first row) of the sample files so that your program can read any file of the same format. For any further clarification post your questions on Moodle.

Some rules apart from prerequisite for courses apply during registration:

  • A student can enrol in at most two courses per semester.
  • A student can only do courses at the same level i.e. if a student has passed all CS course than the student can do courses from upper level.

Currently its semester 2.

Assignment Requirements

  1. This problem must be solved using the Object-Oriented programming paradigm. You need four classes namely student, course, registration and CSstudents.
  1. Create a project in Dev C++ and write class definitions for the above mentioned classes (header files).
  2. Implement the member functions of the classes you defined in part 2 above (c++ files).
  1. Add a source file to your project, the main_driver.cpp.

The driver program should be able to do the following:

  • Create necessary arrays to store the records of the file. The arrays will be of type classes you have defined.
  • Read the data file for up to size of 100.
  • Create a menu for the user that can do the following:
    • Exit program o Display all students at USP o Display all Courses offered at USP
    • Display details of students (id, name, age, and phone) registered in a course entered by user.
    • Register a student into a course. This should also add detail in the necessary files and array. Note, registration has some rules apart from prerequisite of a course.
    • Display all registration
    • Display number of semesters a student will take to complete all CS courses. The user will provide an id number and the program should calculate the number of semesters left.
  • Except the first menu, all others should be implemented using functions of the main program.