Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

you are asked to implement a Library Checking-out/Borrowing System using the C programming language. The program is going to be an application of the Data

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

you are asked to implement a "Library Checking-out/Borrowing System" using the C programming language. The program is going to be an application of the Data Structure, Linked List, that we covered in this week. And to implement a Linked List, you will need to utilize struct in C. In the main() function, we will be able to define Linked Lists that are named/identified by students' name. For example, we can have LLs, John, Alice, and Bob, all initialized to NULL. The LLs represent the "book borrowing records" of the students, correspondingly. Thus, each node in the LL is an entry of such record. An entry contains three attributes (besides the "next record" attribute), namely, book title, due date (how many days until the return deadline), and if reserved (a char [' T ' / F '] indicates if the book is reserved by the student; hence, has no deadline). For example, the LL John can be a list with 3 entries: ("Calculus I", 30, 'F') ( "Calculus II", 40, 'F') ( "Computer Architecture", 0, 'T') N NLL where note that, since the last record is "reserved" ('T'), then the due date attribute is 0 . Then, the librarian can modify a LL, so a new "book borrowing record" entry can either be added or appended to the LL (i.e., a new book is now checked-out), or an existing "book borrowing record" can be delete from the LL (i.e., a book has been returned). The rule for the appending function is simply that, if an entry contains ' T ' as its "reserved" value, then, the entry is going to be appended to the end of the list. If there are other entries that are already "reserved", then a new one is going to be the very last entry (or tail) of this LL. For example, appendLL(\&John, "Calculus III", 0, 'T') will cause the LL to become: ("CalculusI",30,F)("CalculusII",40,F)("ComputerArchitecture",0,T)("CalculusIII",0,T)>NULL The rules for the adding function are that, (a) all entries that contain 'F' as their "reserved" values will appear before (more close to the head) those with ' T ' as their "reserved" values. (b) Then, among all those 'F' entries, the records are ordered based on their "due date" entry. Whichever entry has a smaller "due date" is going to go before those with larger ones. (c) In case of tied scenario, the one being added will appear as the last one among those with the same "due date" value. For example, from Step 6, addLL(\&John, "Machine Learning", 15, 'F') will go before "Calculus I"; and both addLL(\&John, "Discrete Math", 30, 'F') and addLL(\&John, "AI", 35, 'F') will go between "Calculus I" and "Calculus II"; and addLL(\&John, "Linear Algebra", 60, 'F') will go between "Calculus II" and "Computer Architecture". Lastly, the rule for the deleting function is simply if the entry we are trying to delete is in a student's record, delete that record while keeping all other records intact. For Example, from Step 6, deleteLL(\&John, "Computer Architecture") will cause the LL to become: you are asked to implement a "Library Checking-out/Borrowing System" using the C programming language. The program is going to be an application of the Data Structure, Linked List, that we covered in this week. And to implement a Linked List, you will need to utilize struct in C. In the main() function, we will be able to define Linked Lists that are named/identified by students' name. For example, we can have LLs, John, Alice, and Bob, all initialized to NULL. The LLs represent the "book borrowing records" of the students, correspondingly. Thus, each node in the LL is an entry of such record. An entry contains three attributes (besides the "next record" attribute), namely, book title, due date (how many days until the return deadline), and if reserved (a char [' T ' / F '] indicates if the book is reserved by the student; hence, has no deadline). For example, the LL John can be a list with 3 entries: ("Calculus I", 30, 'F') ( "Calculus II", 40, 'F') ( "Computer Architecture", 0, 'T') N NLL where note that, since the last record is "reserved" ('T'), then the due date attribute is 0 . Then, the librarian can modify a LL, so a new "book borrowing record" entry can either be added or appended to the LL (i.e., a new book is now checked-out), or an existing "book borrowing record" can be delete from the LL (i.e., a book has been returned). The rule for the appending function is simply that, if an entry contains ' T ' as its "reserved" value, then, the entry is going to be appended to the end of the list. If there are other entries that are already "reserved", then a new one is going to be the very last entry (or tail) of this LL. For example, appendLL(\&John, "Calculus III", 0, 'T') will cause the LL to become: ("CalculusI",30,F)("CalculusII",40,F)("ComputerArchitecture",0,T)("CalculusIII",0,T)>NULL The rules for the adding function are that, (a) all entries that contain 'F' as their "reserved" values will appear before (more close to the head) those with ' T ' as their "reserved" values. (b) Then, among all those 'F' entries, the records are ordered based on their "due date" entry. Whichever entry has a smaller "due date" is going to go before those with larger ones. (c) In case of tied scenario, the one being added will appear as the last one among those with the same "due date" value. For example, from Step 6, addLL(\&John, "Machine Learning", 15, 'F') will go before "Calculus I"; and both addLL(\&John, "Discrete Math", 30, 'F') and addLL(\&John, "AI", 35, 'F') will go between "Calculus I" and "Calculus II"; and addLL(\&John, "Linear Algebra", 60, 'F') will go between "Calculus II" and "Computer Architecture". Lastly, the rule for the deleting function is simply if the entry we are trying to delete is in a student's record, delete that record while keeping all other records intact. For Example, from Step 6, deleteLL(\&John, "Computer Architecture") will cause the LL to become

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

Accounting And Social Theory An Introduction

Authors: Lisa Jack

1st Edition

1138100714, 9781138100718

More Books

Students also viewed these Accounting questions

Question

Describe identity theft and its psychological consequences.

Answered: 1 week ago

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago