Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Experiment number -3

Diagram

+---------------------+

| Online Shopping |

| System |

+----------+----------+

+----------+----------+

| Customer |

+----------+----------+

+----------+----------+

| Process Order |

+----------+----------+

+-------+----------------+

| |

v v

+-----------+----------+ +----------+

| Product Database | | Order |

| | | Database |

+-----------+----------+ +----------+

| |
v v

+-----------+----------+ +----------+

| Manage Inventory | | Invoice |

+-----------+----------+ | Database |

| +----------+

+-----------+----------+

| Report Database |

+----------------------+

Output-:

Customer Interaction:
Customers interact with the Online Shopping System to place orders.They provide order information
which includes the products they wish to purchase.
Process Order:
The Process Order component of the system validates the order information provided by the
customer.It interacts with the Product Database to retrieve product information related to the ordered
items.It updates the Order Database with the details of the placed order.It generates invoices for the
orders placed, which are stored in the Invoice Database.
Manage Inventory:
This component interacts with the Process Order component to update the inventory levels based on
the orders placed.It ensures that the inventory database is updated accordingly to reflect the changes in
stock levels.
Generate Reports:
The Generate Reports component is responsible for generating various reports related to the online
shopping system.It interacts with the databases to retrieve necessary information and generates reports
such as sales reports, inventory reports, etc.These reports are stored in the Report Database for future
reference.
Data Storage:
The system maintains several databases including Product Database, Order Database, Invoice Database,
and Report Database to store relevant data.These databases store information about products, orders,
invoices, and reports respectively.
Conclusion:
In this experiment, participants learned the process of developing a structured design for a Data Flow
Diagram (DFD) model. By identifying components and drawing the DFD, they gained insights into the
flow of information within the system.
Experiment -4
DIAGRAM
+---------------------+
| Library System |
+---------------------+
|
+---------------------+
| Librarian |
+---------------------+
| |
+-------------+ +------------------+
| Add Book | | Remove Book |
+-------------+ +------------------+
| |
+------------------+ +----------------+
| Manage Members | | Check Availability |
+------------------+ +----------------+
| |
+-------------------+ +--------------+
| Borrow Book | | Return Book |
+-------------------+ +--------------+
|
+--------------+
| Member |
+--------------+
OUTPUT:
The program is executed successfully and provided the output.
CONCLUSION:-
In this experiment, we have successfully developed a UML use case model for a Library Management
System. This model outlines the various actors, their interactions, and the functionality provided by the
system.

Experiment -5
Member System Librarian
| | |
| Borrow Book | |
|------------------------------> | |
| | Check Availability |
| |------------------------->|
| | |
| | Book Availability: Yes |
| |<-------------------------|
| | |
| Book Borrowed | |
|<------------------------ | |
| | |
OUTPUT:-
 The sequence starts with the member initiating the "Borrow Book" action.
 The system checks the availability of the requested book.
 If the book is available, the system updates its status and notifies the member that the book has
been successfully borrowed.
 If the book is not available, the system notifies the member that the book is unavailable.
 There is no direct interaction between the librarian and the member during this sequence, but
the librarian may oversee the process or handle exceptional cases.
Conclusion:-
This sequence diagram demonstrates the flow of interactions between the member, the system, and the
librarian during the borrowing process in the Library Management System.

Experiment-6

Output:-
 The class diagram includes three main classes: Book, Member, and Librarian.
 Each class has attributes representing their properties.
 Each class has operations/methods representing their behavior.
 The relationships between classes are depicted using lines connecting them.
 Book is related to Member for borrowing and returning books, and to Librarian for managing
inventory.
 Member and Librarian are separate entities with their own distinct roles in the system.
Conclusion:-
This class diagram provides a static view of the Library Management System, showing the
classes involved, their attributes, methods, and relationships, helping to understand the
structure of the system.

Experiment-7
// Book class
class Book {
private String title;
private String author;
private String ISBN;
private boolean availability;

public Book(String title, String author, String ISBN) {


this.title = title;
this.author = author;
this.ISBN = ISBN;
this.availability = true; // Initially, book is available
}

public boolean checkAvailability() {


return availability;
}

// Getters and setters


public String getTitle() {
return title;
}

public void setTitle(String title) {


this.title = title;
}

public String getAuthor() {


return author;
}

public void setAuthor(String author) {


this.author = author;
}
public String getISBN() {
return ISBN;
}

public void setISBN(String ISBN) {


this.ISBN = ISBN;
}

// Method to borrow the book


public void borrow() {
if (availability) {
availability = false;
System.out.println("Book '" + title + "' has been borrowed.");
} else {
System.out.println("Sorry, the book '" + title + "' is not available.");
}
}

// Method to return the book


public void returnBook() {
availability = true;
System.out.println("Book '" + title + "' has been returned.");
}
}

// Member class
class Member {
private String memberId;
private String name;
private String email;

public Member(String memberId, String name, String email) {


this.memberId = memberId;
this.name = name;
this.email = email;
}

// Method to borrow a book


public void borrowBook(Book book) {
book.borrow();
}
// Method to return a book
public void returnBook(Book book) {
book.returnBook();
}
}

// Librarian class
class Librarian {
private String librarianId;
private String name;
private String email;

public Librarian(String librarianId, String name, String email) {


this.librarianId = librarianId;
this.name = name;
this.email = email;
}

// Method to add a new book


public void addBook(String title, String author, String ISBN) {
Book book = new Book(title, author, ISBN);
System.out.println("Book '" + title + "' has been added to the library.");
}

// Method to remove a book


public void removeBook(Book book) {
System.out.println("Book '" + book.getTitle() + "' has been removed from the library.");
}

// Method to manage members


public void manageMembers() {
// Method body for managing members (not implemented in this example)
System.out.println("Managing members...");
}
}

// Main class
public class LibraryManagementSystem {
public static void main(String[] args) {
// Creating instances of Book, Member, and Librarian
Book book1 = new Book("The Catcher in the Rye", "J.D. Salinger", "9780316769488");
Member member1 = new Member("M001", "Alice", "alice@example.com");
Librarian librarian = new Librarian("L001", "John", "john@example.com");

// Member borrows a book


member1.borrowBook(book1);

// Member tries to borrow the same book again (should show it's not available)
member1.borrowBook(book1);

// Member returns the book


member1.returnBook(book1);

// Librarian adds a new book


librarian.addBook("To Kill a Mockingbird", "Harper Lee", "9780061120084");

// Librarian removes a book


librarian.removeBook(book1);
}
}
Output:-
Book 'The Catcher in the Rye' has been borrowed.
Sorry, the book 'The Catcher in the Rye' is not available.
Book 'The Catcher in the Rye' has been returned.
Book 'To Kill a Mockingbird' has been added to the library.
Book 'The Catcher in the Rye' has been removed from the library.
Conclusion:-
This code demonstrates the usage of the classes Book, Member, and Librarian as per the class diagram
we developed earlier. It creates instances of these classes and invokes their methods to perform actions
like borrowing, returning, adding, and removing books, and prints appropriate messages for each action.

Experiment-8
BookTest.java
import org.junit.Test;
import static org.junit.Assert.*;

public class BookTest {


@Test
public void testBookAvailability() {
Book book = new Book("The Catcher in the Rye", "J.D. Salinger", "9780316769488");
assertTrue(book.checkAvailability());

// Borrow the book


book.borrow();
assertFalse(book.checkAvailability());

// Return the book


book.returnBook();
assertTrue(book.checkAvailability());
}
}

()); } }
MemberTest.java
import org.junit.Test;
import static org.junit.Assert.*;

public class MemberTest {


@Test
public void testBorrowBook() {
Book book = new Book("The Catcher in the Rye", "J.D. Salinger", "9780316769488");
Member member = new Member("M001", "Alice", "alice@example.com");

member.borrowBook(book);
assertFalse(book.checkAvailability()); // Book should be borrowed
}

@Test
public void testReturnBook() {
Book book = new Book("The Catcher in the Rye", "J.D. Salinger", "9780316769488");
Member member = new Member("M001", "Alice", "alice@example.com");

// Borrow the book first


member.borrowBook(book);
member.returnBook(book);
assertTrue(book.checkAvailability()); // Book should be available after returning
}
}
LibrarianTest.java
import org.junit.Test;
import static org.junit.Assert.*;

public class LibrarianTest {


@Test
public void testAddBook() {
Librarian librarian = new Librarian("L001", "John", "john@example.com");
librarian.addBook("To Kill a Mockingbird", "Harper Lee", "9780061120084");
assertTrue(true); // Just checking that addBook method doesn't throw exceptions
}

@Test
public void testRemoveBook() {
Book book = new Book("The Catcher in the Rye", "J.D. Salinger", "9780316769488");
Librarian librarian = new Librarian("L001", "John", "john@example.com");
librarian.removeBook(book);
assertTrue(true); // Just checking that removeBook method doesn't throw exceptions
}
}

Output
When you run these tests using JUnit, you should see output indicating that all tests passed successfully.
The output will vary depending on the IDE or build tool you are using. For example, if you're using
Eclipse, you'll see green bars indicating that all tests passed. If you're using a build tool like Maven or
Gradle, you'll see a similar output indicating that all tests passed successfully. If any test fails, you'll see
an indication of which test failed along with the reason for the failure.
Conclusion:-
The experiment executed successfully and provide the output

Experiment-9
 Basic understanding of version control concepts.
 Git installed on your local machine. You can download it from git-scm.com.

Tasks:

1. Initialize a Git Repository:


 Open your terminal or command prompt.
 Navigate to the directory where your Library Management System code is located.
 Run the following command to initialize a Git repository:
csharpCopy code
git init

2. Add Files to the Repository:


 Use the following command to add all files to the staging area:
csharpCopy code
git add .

3. Commit Changes:
 Commit the added files to the repository with a meaningful message:
sqlCopy code
git commit - m "Initial commit: Adding Library Management System code"

4. Create Branches:
 Create a new branch for development or feature implementation:
Copy code
git branch feature-branch

5. Switch Branches:
 Switch to the newly created branch:
Copy code
git checkout feature-branch

6. Make Changes:
 Make necessary changes or enhancements to the code in the feature branch.

7. Commit Changes in Feature Branch:


 Add and commit the changes made in the feature branch:
sqlCopy code
git add . git commit - m "Implement feature: [Feature description]"

8. Merge Feature Branch:


 Switch back to the main branch (e.g., master or main):
Copy code
git checkout master
 Merge the changes from the feature branch into the main branch:
sqlCopy code
git merge feature - branch

9. Resolve Conflicts (if any):


 If there are conflicts during the merge, resolve them manually and then commit the changes.

10. Push Changes to Remote Repository:


 Create a repository on a hosting service like GitHub or GitLab.
 Add the remote repository URL:
csharpCopy code
git remote add origin <remote_repository_url>
 Push the changes to the remote repository:
perlCopy code
git push -u origin master

Conclusion:
In this lab, you've learned how to use Git for version control and collaboration in managing the
codebase of the Library Management System. You've learned how to initialize a repository, add
files, create branches, make changes, merge branches, resolve conflicts, and push changes to a
remote repository. These skills are essential for effective code management and collaboration in
software development projects.

Experiment 10

 Access to Trello. You can sign up for free at trello.com.


 Basic understanding of project management concepts.

Tasks:

1. Create a Trello Board:


 Log in to your Trello account.
 Create a new board named "Library Management System Development".

2. Create Lists:
 Create the following lists on the board:
 To Do: For tasks that need to be done.
 In Progress: For tasks that are currently being worked on.
 Done: For tasks that are completed.

3. Add Cards:
 Create cards for each task or feature related to the development of the Library
Management System.
 Assign each card to a specific list based on its status (To Do, In Progress, Done).
 Add descriptions, checklists, due dates, and labels to the cards as needed.

4. Prioritize Tasks:
 Prioritize tasks by dragging and dropping cards within the lists.
 Move the most critical tasks to the top of the "To Do" list.

5. Assign Responsibilities:
 Assign team members to relevant cards by adding them as members of the card.
 Each team member should be responsible for specific tasks or features.

6. Track Progress:
 Move cards across lists as they progress through different stages (e.g., from To Do to In
Progress, and then to Done).
 Use labels, due dates, and checklists to track the status and completion of tasks.

7. Collaborate and Communicate:


 Use card comments to discuss tasks, ask questions, or provide updates.
 Use the @mention feature to notify team members about important updates or
requests.

8. Review and Update Regularly:


 Conduct regular meetings or check-ins to review the board's progress.
 Update the board as tasks are completed, new tasks arise, or priorities change.

Conclusion:
In this lab, you've learned how to use Trello for managing the development of the
Library Management System. By creating lists, adding cards, prioritizing tasks, assigning
responsibilities, tracking progress, collaborating, and communicating effectively, you can
streamline the development process and ensure the project's success. Trello provides a
simple yet powerful platform for organizing and managing projects of any size.

You might also like