Question: please use multiple class files just want to make sure...
Please use multiple class files! Just want to make sure I'm on the right track. This is also using c++
In this lab you will be making an interactive course directory. You will read the information for several courses from file.
Each course will have a title and a set of students, represented by student IDs.
You will read in all the course information from file and then let the user interact with it in various ways.
The file will start by indicating how many courses will be in the file.
Each course follows the format of
- Department code
- Course number
- Number of students in the class
- List of student ids (5-digits with no leading zeroes)
3 EECS 268 5 12345 54321 68454 75984 15348 MATH 521 3 47896 41236 45826 BIO 101 4 96369 85525 14741 98754
Please note, when we test your program we will use new, larger, and more complex files than the sample one provided.
I encourage you to come up with your own test files.
You may assume the files will be properly formatted.
The user will launch your program and pass in the file name containing the course data from the command line (recall argv and argc).
Once the file is read in, provide the user with a menu in order to do the following:
- Print all courses
- The order they appear will be the same order they appeared in the file
- Print all course names (department and number) from the file
- Do not print student ids
- Print all courses for a department
- Obtain a department code from the user then print all courses in that department
- When printing a course, print the department code and number
- Print roster for a course
- Print all the student IDs for a course. Delimit the ids with commas
- Print largest class
- Print the name of the largest class and the amount of students in that class
- Swap two classes
- Obtain two class names (department and number) from the user and swap their positions in the catalog
- If all courses are printed after this, you should see that the two courses swapped positions
- Print schedule for student
- Obtain a student ID from the user and print the names of all courses that student is enrolled in
- Exit the program
In 268, your mains will be very concise, passing control to some kind of Executive class that will then run the show (example main below).
You need to think about how you represent a single entry from the file. Remember, we are making object oriented code, so you need to solve all the problems you encounter by using/create a class!
Things to think about:
- How can I represent a single course?
- What kind of data does a course have, and how will I access it?
- Remember, we're not in the business of public member variables that house critical information
- What kind of information does a course need at construction time?
- What will contain all of the course?
- When swapping courses, what method needs to be defined for a course?
You'll need a class (or classes) to handle other important things:
- verify the file was opened
- You can assume if the file was able to be opened that it is formatted correctly
- Reading the data from file and storing it
- Present the user with a menu and handle the interactions
- Don't assume the user is going to give you good input at the menu!
- Recall the cin failbit
- Deallocate everything (e.g. any arrays or objects) when the Executive object is tossed out of memory