Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

sing good OOP, write a C++ program that will read an input file to manage a list of students waiting to register for a ourse using a linked list. 

The input file name is WaitList.txt and is located in the current directory of the project.

The file layout is as follows:

action    student name

Actions are defined as follows:

1 - add student name to the end of the linked list
2 - add student name to the beginning of the linked list
3 - delete the student at the beginning of the linked list
4 - delete the student at the end of the linked list

Actions #1 and #2 require student names.  Actions #3 and #4 do not.

For example, if the input file contents contained:

1    Sally Sue Student
1    Peter Pupil
1    Sam Scholar
4
2    Terri Tutor
1    Abby Achiever
3
2    Bill Brain

The program would display the wait list as follows:

The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Peter Pupil
4.  Abby Achiever

End of List.

Then the program will prompt the user if they wish to delete a student by name.  If the user selects 'y', the program will prompt for a student name. 
If the name is found in the linked list, the student node will be deleted and the wait list is then displayed.  If the name is not found, an error message is displayed to the user.

If the user selects 'n' to deleting a student by name, the program will end.

The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Peter Pupil
4.  Abby Achiever

End of List.


Would you like to delete a student by name (y = yes, n = no): Y
Enter the full name of the student to delete:  peter pupil

Student deleted.


The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Abby Achiever

End of List.


Would you like to delete a student by name (y = yes, n = no):  y
Enter the full name of the student to delete:  casey clever

Student does not exist on the wait list.


The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Abby Achiever

End of List.


Would you like to delete a student by name (y = yes, n = no):  a
Invalid response, please enter y = yes, n = no:  n

Program end.


Validate all user input values.

Be sure to use good programming methodology and keep your project modular.


Use private member functions and variables.
Use public member functions for a constructor (where appropriate) and a driver method only.

Expert Solution
Check Mark
Step 1

Given that,

Write a C++ program that will read an input file to manage a list of students waiting to register for a course using a linked list. 

The input file name is WaitList.txt and is located in the current directory of the project.

The file layout is as follows:

action    student name

Actions are defined as follows:

1 - add a student name to the end of the linked list
2 - add a student name to the beginning of the linked list
3 - delete the student at the beginning of the linked list
4 - delete the student at the end of the linked list

Actions #1 and #2 require student names.  Actions #3 and #4 do not.

For example, if the input file contents contained:

1    Sally Sue Student
1    Peter Pupil
1    Sam Scholar
4
2    Terri Tutor
1    Abby Achiever
3
2    Bill Brain

The program would display the waitlist as follows:

The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Peter Pupil
4.  Abby Achiever

End of List.

Then the program will prompt the user if they wish to delete a student by name.  If the user selects 'y', the program will prompt for a student name. 
If the name is found in the linked list, the student node will be deleted and the waitlist is then displayed.  If the name is not found, an error message is displayed to the user.

If the user selects 'n' to delete a student by name, the program will end.

The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Peter Pupil
4.  Abby Achiever

End of List.

Would you like to delete a student by name (y = yes, n = no): Y
Enter the full name of the student to delete:  peter pupil

Student deleted.

The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Abby Achiever

End of List.

Would you like to delete a student by name (y = yes, n = no):  y
Enter the full name of the student to delete:  case clever

The student does not exist on the waitlist.

The Wait List:

1.  Bill Brain
2.  Sally Sue Student
3.  Abby Achiever

End of List.

Would you like to delete a student by name (y = yes, n = no):  a
Invalid response, please enter y = yes, n = no:  n

Program end.

Validate all user input values.

Be sure to use good programming methodology and keep your project modular.

Use private member functions and variables.
Use public member functions for a constructor (where appropriate) and a driver method only.

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education