Saturday, September 17, 2022

Construct an ER diagram for the Library management system(DBMS)?

Problem

Draw an ER model for library management application considering the following constraints −

  • In a library multiple students can enroll.

  • Students can become a member by paying an appropriate fee.

  • The books in the library are identified by a unique ID.

  • Students can borrow multiple books from subscribed libraries.

Solution

Follow the steps given below to draw an ER model for the library management application −

Step 1 − Identify the entity sets

The entity set has multiple instances in a given business scenario.

As per the given constraints the entity sets are as follows −

  • Book

  • Publisher

  • Member

  • Section

  • Granter

Step 2 − Identify the attributes for the given entities

  • Book − The relevant attributes are title, author, price, Isbn.

  • Member − The relevant attributes are Name, Bday, MID, address, phone, age.

  • Section − The relevant attributes are Sid, name, phone.

  • Publisher − The relevant attributes are name, phone, Pid, address.

  • Granter − The relevant attributes are phone, name, Nic, post, address.

Step 3 − Identify the Key attributes

  • Sid is the key attribute for the section.

  • Mid is the key attribute for member entities.

  • Isbn is the key attribute for a book entity.

  • Pid is the key attribute for a publisher entity.

  • Nic is the key attribute for a granter entity.

Step 4 − Identify the relationship between entity sets

  • Multiple books are arranged in a single section and one section has multiple books. Hence, the relationship between book and section is many to one.

  • One member borrows multiple books and multiple books can borrow a single person. Hence, the relationship between member and book is one-to-many.

  • One publisher can supply multiple books and multiple books can be supplied by a single publisher. Hence, the relationship between publisher and book is one-to-many.

  • One granter can grant multiple members and multiple members can grant a single granter. Hence, the relationship between grantor and member is one-to-many.

Step 5 − Complete ER diagram

The complete ER diagram is as follows −


https://www.tutorialspoint.com/construct-an-er-diagram-for-the-library-management-system-dbms


C program to demonstrate example of structure of array

 In this program, we will learn how to declare an array of some data type's variables within the structure, which is known as structure of array?

In this example, there is a structure named student having two arrays name and marksname is the character array of 30 characters and marks is the integer array of 5 integers. name will store the name of the student and marks will store the marks of 5 subjects.

/*C program to demonstrate example of structure of array.*/ #include <stdio.h> struct student { char name[30]; int marks[5]; int total; float perc; }; int main() { struct student std; int i; printf("Enter name: "); gets(std.name); printf("Enter marks:\n"); std.total = 0; for (i = 0; i < 5; i++) { printf("Marks in subject %d ?: ", i + 1); scanf("%d", &std.marks[i]); std.total += std.marks[i]; } std.perc = (float)((float)std.total / (float)500) * 100; printf("\nName: %s \nTotal: %d \nPercentage: %.2f", std.name, std.total, std.perc); return 0; }

Output


Enter name: Mike Enter marks: Marks in subject 1? : 88 Marks in subject 2? : 98 Marks in subject 3? : 98 Marks in subject 4? : 78 Marks in subject 5? : 99 Name: Mike Total: 461 Percentage: 92.20

https://www.includehelp.com/c-programs/c-structure-and-union-program-to-demonstrate-example-of-strutucre-of-array.aspx


Class 12 Computer Science MCQ set

  Class 12 Computer Science MCQ set According to the new curriculum and grid of NEB, there is an abrupt change in question pattern. Computer...