Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello! Please do all 3 steps in the C++ program question! I will leave a like. Thank you. Question - Name the program file college.cpp
Hello! Please do all 3 steps in the C++ program question! I will leave a like. Thank you.
Question - Name the program file college.cpp Step 1-Define a class named Student with the following member variables: - firstName (a string) - lastName (a string) - studentID (a string) - phoneNumber (a string with this format 604-555-5555) - gpa (a double number) Member functions include: - 5 accessor and 5 mutator functions - the default constructor which sets all string member variables to a string with one space in it (" ") and gpa to 0 - a constructor with all five parameters - input function - output function that displays the member variables of a student No other function is necessary for this class. Step 2- Define a class named Course with the following member variables: - code: Course code (a string like CMPT1020) - section: Section number (an integer) - capacity: Max number of students (an integer) - numStudents: Actual number of students (an integer) - list: An array that stores the info for the students in the course, as a pointer to a Student object (defined in part 1 ) Member functions include: - 4 accessor functions (for the first four member variables) - 2 mutator functions (for code and section) - Default constructor that sets: code=CMPT1020, section=1, capacity=35, numStudents =0 and allocates memory for list ( 35 students) - A constructor that accepts: code, section number, and capacity. It set numStudents =0 and allocate memory for list (capacity students) - A destructor to free memory - A function named add which adds a student - A function named display (to display all students), this function has no input argument - A function named void displayByFirst(string): that accepts a string for firstName and displays the entire info for the student with given firstName - A function named void displayByLast(string): that accepts a string for lastName and displays the entire info for the student with given last Name - A function named void displayByID(string): that accepts a string for studentID and displays the entire info for the student with given studentID - A function named void displayByPhone(string): that accepts a string for phoneNumber and displays the entire info for the student with given phoneNumber - A function named remove that accepts one string for phone number, this function removes one of the students with given phone number. - A function named sortByFirstAsc: sorts the list based on first names in ascending order - A function named sortByFirstDes: sorts the list based on first names in descending order - A function named sortByLastAsc: sorts the list based on last names in ascending order - A function named sortByLastDes: sorts the list based on last names in descending order - A function named sortByIDAsc: sorts the list based on IDs in ascending order - A function named sortByIDDes: sorts the list based on IDs in descending order - A function named sortByPhoneAsc: sorts the list based on phone numbers in ascending order - A function named sortByPhoneDes: sorts the list based on phone numbers in descending order - A function named sortByGPAAsc: sorts the list based on GPAs in ascending order - A function named sortByGPADes: sorts the list based on GPAs in descending order Step 3- Write the main function to define a Course object and test the functions you defined in the previous stepsStep 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