Skip to content

YuriiJavaDev/JavaBasics_Task_236_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Publishing House: Flexible Book Registration (JavaBasics_Task_236_V0.1)

📖 Description

In the publishing industry, data arrives in stages. This project models a Book entity that can be registered even if its physical properties (like page count) are not yet finalized. By using Constructor Overloading, the system provides two entry points for data: one for early-stage titles and another for completed manuscripts. This approach ensures that every book in the database is properly initialized, maintaining a high level of data consistency.

📋 Requirements Compliance

  • Overloaded Constructors: Provided two distinct ways to instantiate the Book class.
  • Default Value Assignment: Automatically sets the page count to 0 when only a title is provided.
  • State Management: Used the this keyword to correctly map parameters to instance fields.
  • Architectural Separation: Divided the project into Model, Service, and Reporter layers for clean code.
  • Naming Conventions: Followed PascalCase for classes and camelCase for variables/methods.

🚀 Architectural Stack

  • Java 8+ (Constructors, Method Overloading, SRP)

🏗️ Implementation Details

  • Book: The Model. Defines the structure and initialization rules.
  • PublishingService: The Logic. Acts as the "Registrar" for new arrivals.
  • BookReporter: The View. Formats and displays book information to the user.
  • PublishingApp: The Orchestrator. Executes the registration scenario.

📋 Expected result

[PUBLISHING]: Registration complete.
Book: A Mysterious Novel, Pages: 0
Book: Traveling through space, Pages: 500

💻 Code Example

Project Structure:

JavaBasics_Task_236/
            ├── src/
            │   └── com/
            │       └── yurii/
            │           └── pavlenko/
            │               ├── Book.java
            │               ├── PublishingService.java
            │               ├── BookReporter.java
            │               └── PublishingApp.java
            └── README.md

Code

package com.yurii.pavlenko;

public class PublishingApp {

    public static void main(String[] args) {
        PublishingService registrar = new PublishingService();
        BookReporter reporter = new BookReporter();

        Book mysteriousNovel = registrar.registerTitle("A Mysterious Novel");
        Book spaceTravel = registrar.registerFullBook("Traveling through space", 500);

        System.out.println("[PUBLISHING]: Registration complete.");

        reporter.printReport(mysteriousNovel);
        reporter.printReport(spaceTravel);
    }
}
package com.yurii.pavlenko;

public class Book {
    public String bookTitle;
    public int pageCount;

    public Book(String title) {
        this.bookTitle = title;
        this.pageCount = 0;
    }

    public Book(String title, int pages) {
        this.bookTitle = title;
        this.pageCount = pages;
    }
}

⚖️ License

This project is licensed under the MIT License.

Copyright (c) 2026 Yurii Pavlenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...

License: MIT

About

This is a tutorial project. JavaBasics_Task_236_V0.1 Publishing House System: implementing constructor overloading to handle partial (title only) and full (title and pages) book records. 150326_1405

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages