Write a C++ program that creates a linked list of Course data. Each entry in the list is to have the course number such as "CPL510" and its course title such as "Data Structures and Algorithms", and a pointer to the next computer data. Create a Then create a pointer (“head”) that points to the first element in the linked list (initially NULL). Also, you need to create the following methods in the LinkedList class (within LinkedList.h file):

  • bool LinkedList::addElement(string aCourseNumber, string aCourseTitle) - This method attemps to add a new course data into the linked list using the parameter values - course number and course title indicated by the parameter aCourseNumber and aCourseTitle. Its needs to use the struct Course. The courses in the linked list will be in the alphabetical order (you can use compare( ) method for strings in C++) using their course numbers. Therefore, it needs to search the correct location to insert each course information. If there is already a course with the same course number in the linked list, it should not add this new course information and the method should return false. The method should return true otherwise (the new course information was successfully added).
  • bool LinkedList::removeElement(strint aCourseNumber) - This method attemps to remove the course with the parameter aCourseNumber and should return true if it can find and remove the course information. It should return false otherwise (the course with the parameter aCourseNumber does not exist in the linked list).
  • void LinkedList:printList( ) - It prints all entries in the linked list in the following format:
Course Number: CPL120
Course Title: Programming for Computer Engineering

Course Number: CPL340
Course Title: Intro to Programming Languages

Course Number: CPL510
Course Title: Data Structures and Algorithms

Course Number: MAT123
Course Title: Discrete Math Structures
  • LinkedList::~LinkedList( ) - This is a destructor of the LinkedList class. It should remove all elements in the linked list and perform garbage collection (free their memory). At the end, it should print: "The number of deleted courses is: XXXn" where XXX is the number of deleted courses in the linked list.
  • int main() - The main function should start by displaying this menu in this format:
Choicett Actionn
------tt ------n
Att Add Coursen
Dtt Display Coursesn
Qtt Quitn
Rtt Remove Coursen
? tt Display Helpnn

Next, the following prompt should be displayed:

What action would you like to perform?n

Read in the user input and execute the appropriate command. After the execution of each command, redisplay the prompt. Commands should be accepted in both lowercase and uppercase.

The following is an example run (user input is in bold letter):

Choice Action
------ ------
A Add Course
D Display Courses
Q Quit
R Remove Course
? Display Help

What action would you like to perform?
A
Please enter a course information:
Enter a course number:
CPL510
Enter a course title:
Data Structures and Algorithms
The course CPL510 added
What action would you like to perform?
D

Course Number: CPL510
Course Title: Data Structures and Algorithms

What action would you like to perform?
A
Please enter a course information:
Enter a course number:
CPL340
Enter a course title:
Intro to Programming Languages
The course CPL340 added
What action would you like to perform?
A
Please enter a course information:
Enter a course number:
CPL120
Enter a course title:
Programming for Computer Engineering
The course CPL120 added
What action would you like to perform?
D

Course Number: CPL120
Course Title: Programming for Computer Engineering
Course Number: CPL340
Course Title: Intro to Programming Languages
Course Number: CPL510
Course Title: Data Structures and Algorithms

What action would you like to perform?
A
Please enter a course information:
Enter a course number:
CPL340
Enter a course title:
Intro to C++
The course CPL340 exists
What action would you like to perform?
D

Course Number: CPL120
Course Title: Programming for Computer Engineering
Course Number: CPL340
Course Title: Intro to Programming Languages
Course Number: CPL510
Course Title: Data Structures and Algorithms

What action would you like to perform?
A
Please enter a course information:
Enter a course number:
MAT123
Enter a course title:
Discrete Math Structures
The course MAT123 added
What action would you like to perform?
A
Please enter a course information:
Enter a course number:
MAT300
Enter a course title:
Mathematical Structures
The course MAT300 added
What action would you like to perform?
D

Course Number: CPL120
Course Title: Programming for Computer Engineering
Course Number: CPL340
Course Title: Intro to Programming Languages
Course Number: CPL510
Course Title: Data Structures and Algorithms
Course Number: MAT123
Course Title: Discrete Math Structures
Course Number: MAT300
Course Title: Mathematical Structures

What action would you like to perform?
R
Please enter a course number to remove:
MAT242
The course MAT242 does not exist
What action would you like to perform?
D

Course Number: CPL120
Course Title: Programming for Computer Engineering
Course Number: CPL340
Course Title: Intro to Programming Languages
Course Number: CPL510
Course Title: Data Structures and Algorithms
Course Number: MAT123
Course Title: Discrete Math Structures
Course Number: MAT300
Course Title: Mathematical Structures

What action would you like to perform?
R
Please enter a course number to remove:
CPL340
The course CPL340 removed
What action would you like to perform?
D

Course Number: CPL120
Course Title: Programming for Computer Engineering
Course Number: CPL510
Course Title: Data Structures and Algorithms
Course Number: MAT123
Course Title: Discrete Math Structures
Course Number: MAT300
Course Title: Mathematical Structures

What action would you like to perform?
Q
The number of deleted courses is: 4

Implementation/Documentation Requirements:

  • You need to implement this program using C++ and it has to read from the standard input (from a keyboard).
  • You need to define addElement, removeElement, printList, the desructor methods of the LinkedList class
  • Your code should be well documented and commented.
  • You must use the provided data sets.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.