Skip to content

YuriiJavaDev/JavaBasics_Task_336_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graphics Module: Shape Abstraction (JavaBasics_Task_336_V0.1)

📖 Description

In graphics applications, treating different geometric objects through a unified interface is essential for scalability. This project establishes a basic Shape Abstraction model. By defining an abstract Shape class, we create a mandatory requirement for any geometric entity to provide its area. The Circle class serves as the first concrete implementation, encapsulating the specific mathematical logic required to calculate the area of a circular object based on its radius.

📋 Requirements Compliance

  • Core Abstraction: Defined an abstract Shape class to act as a general template.
  • Contract Fulfillment: Implemented the mandatory area() method in the Circle subclass.
  • Mathematical Logic: Applied the circle area formula ($3.14 \times r^2$) within the specific implementation.
  • Execution Verification: Confirmed accurate calculation results through a dedicated launcher application.

🚀 Architectural Stack

  • Java 8+ (Abstract Classes, Inheritance, Basic Mathematics)

🏗️ Implementation Details

  • Shape: The abstract foundation defining the area calculation contract.
  • Circle: A concrete shape implementation managing radius data and area logic.
  • GraphicsLauncherApp: The entry point for testing the geometric calculations.

📋 Expected result

12.56

💻 Code Example

Project Structure:

JavaBasics_Task_336/
├── src/
│   └── com/yurii/pavlenko/
│                 ├── app/
│                 │   └── GraphicsLauncherApp.java
│                 └── graphics/
│                     ├── types/
│                     │   └── Circle.java
│                     └── Shape.java
├── LICENSE
├── TASK.md
├── THEORY.md
└── README.md

Code

package com.yurii.pavlenko.app;

import com.yurii.pavlenko.graphics.types.Circle;

public class GraphicsLauncherApp {

    public static void main(String[] args) {
        
        Circle circle = new Circle(2.0);
        
        System.out.println(circle.area());
    }
}
package com.yurii.pavlenko.graphics;

public abstract class Shape {
    public abstract double area();
}
package com.yurii.pavlenko.graphics.types;

import com.yurii.pavlenko.graphics.Shape;

public class Circle extends Shape {
    private double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    @Override
    public double area() {
        return 3.14 * radius * radius;
    }
}

⚖️ 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_336_V0.1 Graphics Module: implementing a fundamental shape abstraction and circle area calculation logic. 160426_1303

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages