Skip to content

YuriiJavaDev/JavaBasics_Task_334_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HR System Core: Employee Abstraction (JavaBasics_Task_334_V0.1)

📖 Description

In corporate software, managing employee data requires a clear distinction between common identity and role-specific attributes. This project implements a Fundamental HR Module using an abstract Employee class. The base class manages shared state (the name field) and provides a concrete getName() method. Meanwhile, it enforces a getSalary() contract that must be fulfilled by concrete subclasses. The Manager class demonstrates how to implement this contract by returning a fixed compensation value while reusing the name-handling logic of the parent.

📋 Requirements Compliance

  • Base State Management: Implemented a name field and getName() method in the abstract Employee class.
  • Contract Definition: Declared an abstract getSalary() method to mandate compensation logic in subclasses.
  • Role Specialization: Created the Manager class with a dedicated salary field and getter implementation.
  • Constructor Chaining: Used super(name) to pass identity data from the subclass to the abstract parent.

🚀 Architectural Stack

  • Java 8+ (Abstract Classes, Inheritance, State Encapsulation)

🏗️ Implementation Details

  • Employee: The abstract foundation managing identity and defining the salary contract.
  • Manager: A concrete implementation representing a staff member with a fixed salary.
  • HRLauncherApp: The system entry point for data verification.

📋 Expected result

Ivan
50000.0

💻 Code Example

Project Structure:

JavaBasics_Task_334/
├── src/
│   └── com/yurii/pavlenko/
│                 ├── app/
│                 │   └── HRLauncherApp.java
│                 └── hr/
│                     ├── roles/
│                     │   └── Manager.java
│                     └── Employee.java
├── LICENSE
├── TASK.md
├── THEORY.md
└── README.md

Code

package com.yurii.pavlenko.app;

import com.yurii.pavlenko.hr.roles.Manager;

public class HRLauncherApp {

    public static void main(String[] args) {

        Manager manager = new Manager("Ivan", 50000);

        System.out.println(manager.getName());
        System.out.println(manager.getSalary());
    }
}
package com.yurii.pavlenko.hr;

public abstract class Employee {
    protected String name;

    public Employee(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public abstract double getSalary();
}
package com.yurii.pavlenko.hr.roles;

import com.yurii.pavlenko.hr.Employee;

public class Manager extends Employee {
    private double salary;

    public Manager(String name, double salary) {
        super(name);
        this.salary = salary;
    }

    @Override
    public double getSalary() {
        return salary;
    }
}

⚖️ 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_334_V0.1 HR System Core: implementing an abstract Employee base with shared state management and specialized salary calculation for the Manager role. 160426_1130

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages