QuestionQuestion

The application data is text data comprising all the information about books. In other words, you are going to create a library of books!

Create a global database for at least 12 books– array of structures with the following information:
(A) Title of the book
(B) Author name: First name Last name (Examples: William Shakespeare; Stephen King, etc)
(C) Publisher information (McGraw-Hill, etc)
(D) Year of Publication
(E) Subject category (4 letter code or a 3 letter code – FIC, NFIC, HIS, GEO, MAT, PHY, CHEM, ZOO, BIO, COM, COMM, etc)
(F) Shelf at which this book must be placed in the library (“K-M”, “A-C”, “T-V”, etc);
(G) Book is for circulation or for reference
With the above attributes, implement the following search functions. In all these functions, a NIL must be displayed if no such book exists.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "book.h"


book newBook(char titles[], char firstName[], char lastName[], char publisher[],int publicationYear,
    char subject[],char shelf[], book * reference){
    book b;
    strcpy(b.titles,titles);
    strcpy(b.firstName,firstName);
   
    strcpy(b.lastName,lastName);   

    strcpy(b.publisher,publisher);
   
    b.publicationYear = publicationYear;

    strcpy(b.subject,subject);
   
    strcpy(b.shelf,shelf);
   
    b.reference = reference;
      
    return b;
}


void search(char input[], int type){      
    int i;
    book * b;   
    int k;
k = 0;
    for (i = 0; i < SIZE; i++) {
       b = &database[i];
      
       if (type == name &&
                (strcmp(input, b->firstName) == 0
                || strcmp(input, b->lastName) == 0 )) {
            printBook1(b);
k++;
       } else if (type == title &&
                strcmp(input, b->titles) == 0 ) {
            printBook1(b);
k++;
       } else if (type == subject &&
                strcmp(input, b->subject) == 0 ) {
            printBook1(b);
k++;
       }
    }
if (k == 0)
{
printf("No book found\n");
}...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats