Program to Search Schedule


Hey guys so my professor has given my class another program to design that is beyond me and a few of my class mates I came to find out as we just dont have the expertise or the knowledge to really put a program like this together. Would you guys be able to set me on the right track and maybe give me some pointers on how to design this program. Here are the instructions

You will need to write a program to keep track of your class schedule with the following requirements:

1. Store course number, course name, meeting days and times, and location
2. The file should be structured with each course on a separate line, and
each item ( course number, course name, meeting days and times, and
location ) separated by a comma
3. Allow the user to look up an entry based on any of the information stored
4. Allow the user to add new classes
5. Allow the user to continue to look up and add entries until they choose
to exit
6. Use at least two structures.


Drawing things out on paper to visualize usually helps me (in this case just the way the file
and menus would look):

Geography,101,Monday Wednesday Friday 8-9,Room 212
Discrete Math,246,Tuesday Thursday 10-11:30,Room 346
Tennis,131,Monday Wednesday Friday 3-4,Tennis Court


#3 asks for searching, which can be tricky -- use regex , and probably do this part last. Come up with display choices menu; for example:
[1] Search course(s)
[2] Add course(s)
[q] Exit


Since search is complicated, you could either try to make multiple searches yourself, internally (e.g. if user enters something, you search all names, if not found search all course numbers, if not found, search all meeting times, etc. ). Alternately, pressing "1" could lead to another sub-menu:
[1] Search by course name
[2] Search by course number
[3] Search by meeting day/time
[4] Search by room
[q] Go Back


Similarly, adding a course would bring you to a different menu:
[1] Add a course
[q] Go Back


Pseudo code:
1
2
3
4
5
6
7
8
9
10
quitting = false
while (!quitting)
   display_choices
   obtain choice input
   switch(choice)
         1: Search Function (which has its own while loop, etc.)
         2: Add Function 
         q: quitting=true
         default: "Not a valid choice"

(edit: [ tt ] is bad with indents, so I changed to [ code ] though it's not valid code)


Last edited on
I spent the last hour coming up with a solution I may post it but I want you to show me your solution first,

1. Store course number, course name, meeting days and times, and location

- perhaps create a struct or class to hold course name , course number
create a struct or class to hold meeting times and day and location

3. Allow the user to look up an entry based on any of the information stored

- create a vector of courses,courses in turn should have a vector of schedules (which keeps track of meeting days and times) loop through both vectors and test in an if statement to see if data typed in matches data stored

4. Allow the user to add new classes
- again using a vector,first create a function to create a new class then add to a vector

5. Allow the user to continue to look up and add entries until they choose
- put everything in a while loop and break when they want to quit(hit a certain key )

Last edited on
Topic archived. No new replies allowed.