Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Implement the University Course structure and supporting functions (30 points) Rowan university runs many hundreds of courses each semester and needs to keep track
C++
Implement the University Course structure and supporting functions (30 points)
Rowan university runs many hundreds of courses each semester and needs to keep track of the key information on each one. Among the data needed for each course would be the following:
University course identification number: 5 digits + 1 char for semester. You can assume three semesters: fall (f), spring(s) and summer(u) that starts on September 1st, January 21st and June 10th, respectively. For example, 70302f. IMPORTANT: Store the course ID as a string named course_ID . You must validate that the course ID is correct. The correct course ID is valid only if:
o Course ID consists of 6 characters only
o First five characters are digits
o Last character is either F, S, or U
Department that offers this course: implement this as an enumerated data type that contains 5 -10 entries of your choice. Store as department school in the struct
Days of the week the course meets: implement this as an enumerated data type.
Times the course meets: implement this as an enumerated data type. NOTE: You need only store the start time. Call this time start
Write the following functions:
Function, called get_course_info, that retrieves course information from the user (you may want to implement additional functions that retrieve individual course characteristics)
Function, called print_course_info, that displays the course information on the screen (you may want to implement additional functions to display individual course characteristics)
Function, called process_course_info, that asks continuously asks user to input course info (calls get_course_info) and does the following:
o Displays all the courses that are offered in a given semester (called print_course_info(char choice))
o Returns a course that has the largest enrollment (largest number of students currently enrolled) called max_enrollment_course
Returns a course that has smallest number of credits called min_credits_course
Your main function should call process_course_info function that accepts an array of courses and its size and then display (calls print_course_info) information about the entire array of courses
o A function that accepts a reference parameter to a filled array of university_Course types of and a reference to an EMPTY 3 element array of university_Course elements and then fills the empty array with all of courses (from the filled array) for a given semester, department, day of the week, and start time that are supplied (i.e. should return all classes up to 3 total for a given semester and department and meet on the supplied day of the week) call this find_courses
Prototype:
void find_courses(university_Course& all[], int size_All, university_Course& result[], int result_Size, department school, day chosen, time meets_At, char semester);
Note: for this function you will have to process the items in the all[] array, and check their variables for a match
You will have to process the string course_ID to find the character to check against the input semester char
If there are more than 3 university_Course items that match, then you must output a message to the user that indicates there are more courses and they should consult their Student Course Selection Guide for more info
If there are less than 3 items that match your program should ONLY print the number of items that there are and nothing else
If there are NO items that match output a message to the user asking them to choose different search restrictions
You may also want implement supporting functions for input and display the values of each enumerated data type. Implementing these will make the job of coding the main functions much much easier.
o Number of credits for the course
o Maximum course enrollment
o Number of students currently enrolled.
o The course_ID
Create a data structure using C++ constructs enum and struct to represent a Rowan University Course.
Here is the outline of the function main:
int main()
{
//Declarations are omitted
//Make sure to declare a 10 element array to store the University Courses and an empty 3 element result array
...
//Start do-loop
//START For-LOOP and process until all 10 elements are filled
// Input course info and process it on the input
process_course_info(...);
//Store the university_Course in all courses array
// Arguments passed into the function are omitted
//END For-LOOP
// Display the course with largest enrollment
print_course_info (max_enrollment_course); //you will have to find the max enrollment course FIRST
print_course_info (min_credits_course); //you will have to find the min credits course FIRST
//Ask user for a department, a day, a meet time, and semester
//and pass these as arguments to find_courses
//Loop over the result array and print info, if it is empty nothing should print other than the error message
//End Do-loop, looping until user chooses to exit by entering Q or q
return 0;
}
For an EXTRA CREDIT 3 points, include an algorithmic analysis of this program. I.E. Tell me what the Big O() notation for this program is in total. You must show your work by showing me how you assigned time evaluations.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started