Skip to content

michellesanseverino/library_practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Typing SVG

Java OOP Console Status


A clean, fully object-oriented Java console application to manage a library's books, authors, customers, and loans.


πŸ‡ΊπŸ‡Έ English Β· πŸ‡§πŸ‡· PortuguΓͺs



πŸ‡ΊπŸ‡Έ English Version

πŸ“– About

Digital Library System is a Java console application built from scratch to simulate a real-world library management experience. Designed with clean OOP principles, the project covers class design, object relationships, collections, and user interaction β€” all through a text-based menu interface.

This project was developed as part of a Java learning journey, focused on applying and expanding core concepts in a practical, real-world scenario.


✨ Features

Feature Description
πŸ“š List Available Books View all books currently available for borrowing
πŸ” Search Books Find books by title or author
🎭 Filter by Genre Browse books from a specific genre
πŸ†• Filter Recent Books See books added in the last 7 days
🀝 Borrow a Book Register a loan by linking a book to a customer
πŸ‘€ Register Customer Add a new customer with name and email
πŸ“‹ List Customers View all registered customers
πŸ“œ Loan History View all loans associated with a specific customer
πŸšͺ Exit Gracefully close the application

πŸ—οΈ Project Structure

πŸ“¦ digital-library
 ┣ πŸ“„ Main.java            β†’ Entry point & interactive console menu
 ┣ πŸ“„ Library.java         β†’ Container holding books, authors, and loans
 ┣ πŸ“„ LibraryService.java  β†’ Business logic (search, filter, borrow, customers)
 ┣ πŸ“„ Book.java            β†’ Book model (id, title, author, genre, dates, availability)
 ┣ πŸ“„ Author.java          β†’ Author model (id, name, birthDate)
 ┣ πŸ“„ Customer.java        β†’ Customer model (id, name, email)
 β”— πŸ“„ LibraryLoan.java     β†’ Loan model (book ↔ customer, borrow/return dates)

🧠 Class Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Library   │◄───────│ LibraryLoan  β”‚
│─────────────│  loans │──────────────│
β”‚ books       β”‚        β”‚ id           β”‚
β”‚ authors     β”‚        β”‚ book ──────────────► Book
β”‚ loans       β”‚        β”‚ customer ──────────► Customer
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚ borrowDate   β”‚
                       β”‚ returnDate   β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ LibraryService β”‚     β”‚    Book      β”‚     β”‚   Author     β”‚
│────────────────│     │──────────────│     │──────────────│
β”‚ + searchBooks  β”‚     β”‚ id           β”‚     β”‚ id           β”‚
β”‚ + filterGenre  β”‚     β”‚ title        β”‚     β”‚ name         β”‚
β”‚ + borrowBook   β”‚     β”‚ author       β”‚     β”‚ birthDate    β”‚
β”‚ + getHistory   β”‚     β”‚ genre        β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ + register...  β”‚     β”‚ available    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚ dates        β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚  Customer    β”‚
                                            │──────────────│
                                            β”‚ id           β”‚
                                            β”‚ name         β”‚
                                            β”‚ email        β”‚
                                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Getting Started

Prerequisites

  • Java 17 or higher installed
  • A terminal / command prompt

Running the project

# 1. Clone the repository
git clone https://github.com/michellesanseverino/library_practice.git
cd library_practice

# 2. Compile all Java files
javac *.java

# 3. Run the application
java Main

Expected output

╔══════════════════════════════════════╗
β•‘     Welcome to the Digital Library!  β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

══════════════════════════════
  MAIN MENU
══════════════════════════════
  1. List available books
  2. Search books (title/author)
  3. Filter books (genre/recent)
  4. Borrow a book
  5. List all customers
  6. Register new customer
  7. View customer loan history
  0. Exit
══════════════════════════════
>

πŸ”§ Concepts Applied

  • Object-Oriented Programming β€” Encapsulation, abstraction, and class responsibility separation
  • Collections β€” List<T> and ArrayList<T> for storing books, authors, customers, and loans
  • Java Streams β€” .stream().filter().collect() for search and filtering logic
  • LocalDate API β€” Date handling for registration, loans, and filtering recent books
  • Service Layer Pattern β€” LibraryService separates business rules from the UI layer
  • Console I/O β€” Scanner for user interaction with proper input validation

🌱 Possible Improvements

  • Persist data with file I/O or a database (SQLite / H2)
  • Add a return book feature with returnDate
  • Implement fine calculation for overdue loans
  • Add a book registration menu option
  • Unit tests with JUnit 5





πŸ‡§πŸ‡· VersΓ£o em PortuguΓͺs

πŸ“– Sobre

Sistema de Biblioteca Digital Γ© uma aplicaΓ§Γ£o Java de console criada do zero para simular o gerenciamento real de uma biblioteca. Desenvolvida com princΓ­pios limpos de POO, o projeto cobre design de classes, relacionamentos entre objetos, coleΓ§Γ΅es e interaΓ§Γ£o com o usuΓ‘rio β€” tudo por meio de um menu de texto interativo.

Este projeto foi desenvolvido como parte de uma jornada de aprendizado em Java, com foco em aplicar e expandir os conceitos principais em um cenΓ‘rio prΓ‘tico e real.


✨ Funcionalidades

Funcionalidade DescriΓ§Γ£o
πŸ“š Listar Livros Veja todos os livros disponΓ­veis para emprΓ©stimo
πŸ” Buscar Livros Encontre livros por tΓ­tulo ou autor
🎭 Filtrar por GΓͺnero Navegue por livros de um gΓͺnero especΓ­fico
πŸ†• Livros Recentes Veja livros adicionados nos ΓΊltimos 7 dias
🀝 Realizar Empréstimo Registre um empréstimo vinculando livro a cliente
πŸ‘€ Cadastrar Cliente Adicione um novo cliente com nome e e-mail
πŸ“‹ Listar Clientes Visualize todos os clientes cadastrados
πŸ“œ HistΓ³rico de EmprΓ©stimos Veja todos os emprΓ©stimos de um cliente especΓ­fico
πŸšͺ Sair Encerra a aplicaΓ§Γ£o com uma mensagem de despedida

πŸ—οΈ Estrutura do Projeto

πŸ“¦ digital-library
 ┣ πŸ“„ Main.java            β†’ Ponto de entrada e menu interativo no console
 ┣ πŸ“„ Library.java         β†’ ContΓͺiner com livros, autores e emprΓ©stimos
 ┣ πŸ“„ LibraryService.java  β†’ Regras de negΓ³cio (busca, filtro, emprΓ©stimo, clientes)
 ┣ πŸ“„ Book.java            β†’ Modelo de livro (id, tΓ­tulo, autor, gΓͺnero, datas, disponibilidade)
 ┣ πŸ“„ Author.java          β†’ Modelo de autor (id, nome, dataNascimento)
 ┣ πŸ“„ Customer.java        β†’ Modelo de cliente (id, nome, email)
 β”— πŸ“„ LibraryLoan.java     β†’ Modelo de emprΓ©stimo (livro ↔ cliente, datas)

πŸš€ Como Executar

PrΓ©-requisitos

  • Java 17 ou superior instalado
  • Um terminal / prompt de comando

Executando o projeto

# 1. Clone o repositΓ³rio
git clone https://github.com/michellesanseverino/library_practice.git
cd library_practice

# 2. Compile todos os arquivos Java
javac *.java

# 3. Execute a aplicaΓ§Γ£o
java Main

🧠 Conceitos Aplicados

  • ProgramaΓ§Γ£o Orientada a Objetos β€” Encapsulamento, abstraΓ§Γ£o e separaΓ§Γ£o de responsabilidades entre classes
  • ColeΓ§Γ΅es β€” List<T> e ArrayList<T> para armazenar livros, autores, clientes e emprΓ©stimos
  • Java Streams β€” .stream().filter().collect() para lΓ³gica de busca e filtragem
  • API LocalDate β€” ManipulaΓ§Γ£o de datas para cadastro, emprΓ©stimos e filtro de livros recentes
  • PadrΓ£o Service Layer β€” LibraryService separa as regras de negΓ³cio da camada de interface
  • Console I/O β€” Scanner para interaΓ§Γ£o com o usuΓ‘rio com validaΓ§Γ£o de entrada

🌱 Possíveis Melhorias

  • Persistir dados com arquivo ou banco de dados (SQLite / H2)
  • Adicionar funcionalidade de devoluΓ§Γ£o de livro com returnDate
  • Implementar cΓ‘lculo de multa para emprΓ©stimos em atraso
  • Adicionar opΓ§Γ£o de cadastro de livro pelo menu
  • Testes unitΓ‘rios com JUnit 5


Made with β˜• and Java

About

Object-oriented Library System in Java. Manage books, customers and loans with search, genre filters, and borrowing history.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages