This assignment deals with students selecting courses to add to

 

This assignment deals with students selecting courses to add to their schedules. You will implement the logic to add courses to a Schedule (Schedule.h and Schedule.cpp). This will involve writing the code to add Courses to a Container, writing a display function, and working with iterators.

Revisit our lecture discussion on output redirection, diff, sdiff, vimdiff, and the editor-about-which-we-do-not-speak.

Note that I provide you my compiled solution. All output generated by your implementation must exactly match the output generated by my compiled solution. You will need to again practice your head-to-head testing skills from CS 250 (or CS 333).

2.1 Input

The program reads data from two files, students-0x.txt and requests-0x.txt. File extensions on Linux may be arbitrary–i.e., this file could have been named with .dat as the extension.

The first file, students-0x.txt, lists names of students.

Example 1: students-0x.txtJon Snow John Smith Bob Jones David Jones Tommy Oliver Tom Smith 

You may assume a valid input file–i.e., that no two students share a name. The second file, requests-0x.txt, contains a list of enrollment requests.

Example 2: requests-01.txtJon Snow; CS330 12345 3 Jon Snow; CS330 12345 3 Jon Snow; CS300 34567 3 John Smith; CS355 45678 3 John Smith; CS330 12345 3 John Smith; CS330 23456 3 John Smith; CS300 34567 3 Bob Jones; CS300 34567 3 Bob Jones; CS355 45678 3 Bob Jones; CS330 12345 3 Bob Jones; CS300 34567 3 Bob Jones; CS361 34569 3 Bob Jones; IT310 78192 3 Bob Jones; Stat330 78195 3 David Jones; CS330 12345 3 Tom Smith; CS330 12345 3 Tommy Oliver; CS665 56789 3 

2.2 Output

The output consists of three reports written to standard output, one after the other.

  1. A report listing of all student names.
  2. A report listing of all enrollment requests.
  3. Finally, a detailed report is printed, listing data for each student:
    • Name
    • Schedule
    • Total Credit hours

If the program is run with the students-01.txt and requests-01.txt as input, the following output should be generated:

Example 3: Sample OutputStudent List ------------------------------------------------------------  Jon Snow  John Smith  Bob Jones  David Jones  Tommy Oliver  Tom Smith  Enrollment Request Log ------------------------------------------------------------ Jon Snow        WAS     enrolled in CS330 Jon Snow        WAS NOT enrolled in CS330 Jon Snow        WAS     enrolled in CS300 John Smith      WAS     enrolled in CS355 John Smith      WAS     enrolled in CS330 John Smith      WAS NOT enrolled in CS330 John Smith      WAS     enrolled in CS300 Bob Jones       WAS     enrolled in CS300 Bob Jones       WAS     enrolled in CS355 Bob Jones       WAS     enrolled in CS330 Bob Jones       WAS NOT enrolled in CS300 Bob Jones       WAS     enrolled in CS361 Bob Jones       WAS NOT enrolled in IT310 Bob Jones       WAS NOT enrolled in Stat330 David Jones     WAS     enrolled in CS330 Tom Smith       WAS     enrolled in CS330 Tommy Oliver    WAS     enrolled in CS665  Student Schedule Report ------------------------------------------------------------  Jon Snow   - 3 credits - CS330 (CRN 12345)   - 3 credits - CS300 (CRN 34567)   (6 Total Credits)   John Smith   - 3 credits - CS355 (CRN 45678)   - 3 credits - CS330 (CRN 12345)   - 3 credits - CS300 (CRN 34567)   (9 Total Credits)   Bob Jones   - 3 credits - CS300 (CRN 34567)   - 3 credits - CS355 (CRN 45678)   - 3 credits - CS330 (CRN 12345)   - 3 credits - CS361 (CRN 34569)   (12 Total Credits)   David Jones   - 3 credits - CS330 (CRN 12345)   (3 Total Credits)   Tommy Oliver   - 3 credits - CS665 (CRN 56789)   (3 Total Credits)   Tom Smith   - 3 credits - CS330 (CRN 12345)   (3 Total Credits)  

The easiest way to see generate the expected output is to run the sample executable solution I have provided. The input files and inventory size are named as command-line parameters.

For example, if the sample data above is kept in students-01.txt and requests-01.txt, to run this program, type:

./register students-01.txt requests-01.txt

I have provided a second requests file (i.e., requests-02.txt). Run the command:

./register students-01.txt requests-02.txt

and examine the results. Compare the results generated by your solution to the provided solution (i.e., apply your head-to-head testing skills).

2.3 IDEs and Command Line Arguments

(On a Windows system, you would omit the “./”. If you are running from Code::Blocks or a similar development environment, you may need to review how to supply command-line parameters to a running program.) Note that Eclipse provides the option to configure command line arguments.

3 Your Tasks

One of the most important skills in our craft is interpreting error messages. Remember the ones you receive when you attempt to compile the unmodified code. These messages will disappear once you implement the Big-3 (or until you introduce stub-functions as placeholders).

The key abstractions employed in this program are Course, Student, and Schedule. Complete ADT implementations have been provided for the former two. A partial implementation has been provided for the Schedule. Your task is to finish the Schedule ADT.

You must start by implementing two functions:

You must implement:

You can implement the latter four functions with loops.

You can, alternatively, use the built-in C++ functions discussed in Review 03 Example 8 (if you like a challenge).

  1. Schedule::appendNoCheck. This method takes a course and adds it to allCourses. It performs no Schedule checks.
  2. Schedule::getCredits. This method computes the sum of credits in the schedule (i.e., adds the credits contributed by each course in allCourses).
  3. Schedule::wouldViolateCreditLimit. If course along with the existing courses would exceed 12 hours, return true. Return false otherwise.
  4. Implement Schedule::alreadyInSchedule. Traverse the list of courses. If course matches an course already present in the schedule return true. Return false otherwise.
  5. Implement Schedule::display. This must generate the Inventory summary. If using the sample data listed above:
    ./register students-01.txt requests-01.txt
    There is no formatting applied with setw. All spacing consists of hard-coded spaces.
    [hint] Pay close attention to the Course class. [hint]
    Employ your Head-to-Head Testing Skills.your display function should generate–for Jon Snow:
    Jon Snow   - 3 credits - CS330 (CRN 12345)   - 3 credits - CS300 (CRN 34567)   (6 Total Credits)
    and–for Bob Jones:
    Bob Jones   - 3 credits - CS300 (CRN 34567)   - 3 credits - CS355 (CRN 45678)   - 3 credits - CS330 (CRN 12345)   - 3 credits - CS361 (CRN 34569)   (12 Total Credits)

I just want the changes to be on Schedule.cpp leave everything the same

Looking for a Similar Assignment? Our ENL Writers can help. Use the coupon code FIRSTUVO to get your first order at 15% off!