his project requires you to write code to record which clients borrow books froma library. It's a small library for a small town. Hence, each client can onlyborrow one book at a time. The problem is...

his project requires you to write code to record which clients borrow books froma library. It's a small library for a small town. Hence, each client can onlyborrow one book at a time. The problem is divided into four parts. The requirementsfor all functions are below the main function. Please start by coding the firstfunction: create_book. Then the next function: print_book. If you code thesefunctions in order, you will be able to complete this project more quickly than ifyou code them randomly


/* Total points: 250 This project requires you to write code to record which clients borrow books from a library. It's a small library for a small town. Hence, each client can only borrow one book at a time. The problem is divided into four parts. The requirements for all functions are below the main function. Please start by coding the first function: create_book. Then the next function: print_book. If you code these functions in order, you will be able to complete this project more quickly than if you code them randomly. Part 1: Include necessary libraries and constants. Code the Book and Client structs. See function requirements below for the Part 1 functions. Code the functions and test them in main. Test your functions. Part 2: Code the Book_Array and Client_Array structs. See function requirements below for the Part 2 functions. Code the functions and test them in main. Test your functions. Part 3: See function requirements below for the Part 3 functions. Code the functions and test them in main. Test your functions. Part 4: See function requirements below for the Part 4 functions. Code the functions and test them in main. Test your functions. Sample program output: ****Part 1: Test item structures ID: 1 Name: The Gemini Contenders Author: Robert Ludlum Client ID: -1 ID: 1 Name: Clown, Krusty ****Part 2: Test array structures ID: 1 Name: The Hunt for Red October Author: Tom Clancy Client ID: 4 ID: 2 Name: Patriot Games Author: Tom Clancy Client ID: 1 ID: 3 Name: The Sum of All Fears Author: Tom Clancy Client ID: 3 ID: 4 Name: The Bourne Identity Author: Robert Ludlum Client ID: 2 ID: 5 Name: The Bourne Supremacy Author: Robert Ludlum Client ID: 5 ID: 6 Name: The Bourne Ultimatum Author: Robert Ludlum Client ID: -1 ID: 1 Name: Simpson, Homer ID: 2 Name: Simpson, Marge ID: 3 Name: Simpson, Bart ID: 4 Name: Simpson, Lisa ID: 5 Name: Simpson, Cat ****Part 3: Test find functions ID: 1 Name: The Hunt for Red October Author: Tom Clancy Client ID: 4 ID: 4 Name: The Bourne Identity Author: Robert Ludlum Client ID: 2 ID: 3 Name: Simpson, Bart ID: 2 Name: Simpson, Marge ****Part 4: Test search functions Book-Client ID: 4 Name: The Bourne Identity Author: Robert Ludlum Client ID: 2 ID: 2 Name: Simpson, Marge ID: 5 Name: Simpson, Cat ID: 1 Name: The Hunt for Red October Author: Tom Clancy Client ID: 5 */ // (5 points) Import standard input/output library // (5 points) Constants go here // Constant for length of arrays called CAPACITY with value 100 // Constant for length of names and authors called NAME_SIZE with value 30 // Structures go here /* (10 points) Write a struct called Book that has 4 fields: An integer id A string name with NAME_SIZE chars A string author with NAME_SIZE chars An integer client_id You should be able to declare the struct as "Book b" */ /* (10 points) Write a struct called Book_Array that has three fields: An array called array of Book with CAPACITY elements An integer capacity to contain the allocated length (will be set to CAPACITY when declared) An integer count to contain the number of Books inserted (will be set to zero when declared) You should be able to declare the struct as "Book_Array ba" */ /* (10 points) Write a struct called Client that has 2 fields: An integer id A string name with NAME_SIZE chars You should be able to declare the struct as "Client c" */ /* (10 points) Write a struct called Client_Array that has three fields: An array called array of Client with CAPACITY elements An integer capacity to contain the allocated length (will be set to CAPACITY when declared) An integer count to contain the number of Clients inserted (will be set to zero when declared) You should be able to declare the struct as "Client_Array ca" */ // (10 points) Function prototypes go here // Part 1 prototypes // Part 2 prototypes // Part 3 prototypes // Part 4 prototypes // (10 points) Main function goes here /* The main function should demonstrate that your program works. For Part 1, the output should look like the example in the screen output above. After coding the structs and the functions in Part 1, test your code and fix any errors. To test Part 1: Declare a Book by calling the create_book function Print the Book by calling the print_book function Declare a Client by calling the create_client function Print the Client by calling the print_client function After coding Part 2: Declare a Book_Array by calling the create_book_array function Insert the six Books in the example output above by calling the insert_book function Print the Book_Array by calling the print_book_array function Declare a Client_Array by calling the create_client_array function Insert the five Clients in the example output above by calling the insert_client function Print the Client_Array by calling the print_client_array function After coding Part 3: Write code to test the find_book_by_name function and print result as shown in the example above. Write code to test the find_book_by_id function and print result as shown in the example above. Write code to test the find_client_by_name function and print result as shown in the example above. Write code to test the find_client_by_id function and print result as shown in the example above. After coding Part 4: Write code to test the find_client_book function and print result as shown in the example above. Write code to test the find_book_client function and print result as shown in the example above. */ // Functions for Part 1 /* (10 points) Write a function called create_book that accepts parameters: Integer id String name String author Integer client_id and returns a Book. The function should: Declare a Book Copy the parameters to the Book Return the Book */ /* (10 points) Write a function called print_book that accepts parameter Book b and prints the Book to screen as: ID: 1 Name: The Hunt for Red October Author: Tom Clancy Client ID: 4 */ /* (10 points) Write a function called create_client that accepts parameters: Integer id String name and returns a Client. The function should: Declare a Client Copy the parameters to the Client Return the Client */ /* (10 points) Write a function called print_client that accepts a parameter Client c and prints the Client to screen as: ID: 1 Name: Simpson, Homer */ // Functions for Part 2 /* (10 points) Write a function called create_book_array that accepts no parameters and returns a Book_Array. The function should:
Apr 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here