Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Language Instructions Part 1 : Write a program that can be used as a database of student s information for a department. The program

C Language Instructions
Part 1: Write a program that can be used as a database of students information for a department. The program should be able to dynamically allocate or de-allocate storage for the students records using linked lists. You must use a linked list to keep the list of items for this program.
The database should have the following fields: the first and last names, a course code, and a grade for a student. You can use a struct, class or any data type of your choice to store the information.
The program should display the following menu:
Welcome to the database menu!
Press 1 to insert a new record
Press 2 to delete a record
Press 3 to search the database (by last name)
Press 4 to print a range in the database
Press 5 to find the class average for a course
Press 9 to quit
The insert function should work regardless of the position. Position 0 refers to the position before the first record. Any position greater than the length of the database should be put as the last position.
Similarly, the delete position should work for any position. Make sure that it works even when deleting the first, last or middle records.
The search function should be used to search by last name. If that student is found, all records associated with that student should be printed (on the screen). The print function should work regardless of the range requested. If the start or end ranges are not defined, only the valid records should be printed. Hint: To compute the class average, first search the field with the course code. Only average those grades that match the proper course code.
Implement the above program in ANY programming language using any technique that you want (using a Linked List) to meet the requirements as described above. You may choose to use a doubly or singly link list structure for this project.
Part 2: A circular list is a linked list in which the last link points back to the first link. There are many ways to design a circular list. Sometimes there is a pointer to the start of the list. However, this makes the list less like a real circle and more like an ordinary list that has its end attached to its beginning.
Make a class for a singly linked circular list that has no end and no beginning. The only access to the list is a single reference, current, that can point to any link on the list. This reference can move around the list as needed. Your list should handle insertion, searching, and deletion. You may find it convenient if these operations take place one link downstream of the link pointed to by current. (Because the upstream link is singly linked, you cant get at it without going all the way around the circle.) You should also be able to display the list (although youll need to break the circle at some arbitrary point to print it on the screen). A step method that moves current along to the next link might come in handy too.
Implement the above program in ANY programming language using any technique that you want to meet the requirements as described above. Include a simple main driver program to demonstrate your list functionality. Your list can hold any item or object that you want.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions